RubyMine: Rails Generate Model random behaviour (generating test instead of normal models)

When trying to generate model using GUI generate dialog, sometimes the command issued is to generate Test model instead of normal model and migration.

 

For instance, when generating model "problem type:string{45} description:text", instead of generating this model and associated migration, it instead generates 'test/models/problem_test.rb' with the following command:

/Users/devuser/.rvm/rubies/ruby-2.4.1/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/devuser/.rvm/gems/ruby-2.4.1@storage-api/bin/spring rails generate test_unit:model problem name:string{45} description:text -s --skip-fixture
create test/models/problem_test.rb
Running via Spring preloader in process 15642

The dialog has settings as show in the screenshot.

Is there anything else I can provide to help me troubleshoot this issue?

If it helps, because I have noticed some related yet strange behaviour, this sort of incorrect generation happens when current active editor has either migration files or the database.yml file is open and cursor was in the test db config section. This might just be a coincidence, but worth mentioning.

Cheers,
Abhi

0
3 comments
Avatar
Permanently deleted user

So there doesn't seem to be any pattern to this behaviour. Irrespective of the current file open in current editor (whether it is a model or a migration file), randomly the generator string is either for generating a test model or normal model with migration.

Using the Model generator dialog, for the following model

GameSession start:datetime end:datetime game:references

The command generated and run, alternates between the following two (pretend is ticked so I don't actually generate the files):

/Users/devuser/.rvm/rubies/ruby-2.4.1/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/devuser/.rvm/gems/ruby-2.4.1@storage-api/bin/spring rails generate model GameSession start:datetime end:datetime game:references -p -s --skip-fixture
invoke active_record
create db/migrate/20180130053539_create_game_sessions.rb
create app/models/game_session.rb
Running via Spring preloader in process 20092 

or

/Users/devuser/.rvm/rubies/ruby-2.4.1/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/devuser/.rvm/gems/ruby-2.4.1@storage-api/bin/spring rails generate test_unit:model GameSession start:datetime end:datetime game:references -p -s --skip-fixture
create test/models/game_session_test.rb
Running via Spring preloader in process 20174

Any help would be appreciated, why such a random behaviour exists.

0

Hello,

according to the log that you provided in RUBY-20912 you were invoking different generators so could you please check it again. 

0
Avatar
Permanently deleted user

Replied to the bug report RUBY-20912.

0

Please sign in to leave a comment.