I am starting a new project, and have done this meany times now. However, this is the first time I have run into this issue!
I created the app as normal rails new myapp -d postgresql
I've created the DB using rails db:create
and ran the site rails s
. It all works, and I see the Rails welcome/holding page.
Now I start to create my models, rails g model user
for example. And I get this!
Expected string default value for `--jbuilder`; got true (boolean)
invoke active_record
The name 'User' is either already used in your application or reserved by Ruby on
Rails. Please choose an alternative and run this generator again.
Ok that's fair enough, I understand the error message. So I thought I would try to create a different model. When I run rails g model testing
, and I get...
Running via Spring preloader in process 31815
Expected string default value for '--jbuilder'; got true (boolean)
invoke active_record
create db/migrate/20161217171019_create_testings.rb
create app/models/testing.rb
invoke test_unit
create test/models/testing_test.rb
create test/fixtures/testings.yml
Has anyone else had this issue and if so any ideas why? I have tried running bundle install
and bundle update
with no luck. I have also tried setting the thor version as mentioned in this post
I am using Rails 5.0.0.1 and Ruby 2.3.1. I noticed this has only just started happening since I did an update to macOS to 10.12.1 I am not sure if they are related.
Update
So I started to test this out. And I created a couple of different projects 'rails new testapppg' and 'rails new testapp-pg'.
On both of apps I changed the thor gem gem 'thor', '0.19.1'
. I then went on to run bundle update, and create the DB. Now both of these projects created the test models when running rails g model sample
Cool! So that is the fix. So I went back and recreated my pxl-insight app, updated the thor gem, created the DB. Now when I went to create the model I get the errors again!?
So my next question is does Rails cache project names? which is why the new projects worked fine, but the one with the previously used name causes the error?