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
Please sign in to leave a comment.
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
The command generated and run, alternates between the following two (pretend is ticked so I don't actually generate the files):
or
Any help would be appreciated, why such a random behaviour exists.
Hello,
according to the log that you provided in RUBY-20912 you were invoking different generators so could you please check it again.
Replied to the bug report RUBY-20912.