So i am starting a new project, and have done this meany times now. However this is the first time i have hit 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. Awesome!! 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 fair enough, i get the error message. So i thought i would test out another model. So 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.
The only change to my system that i can think of is that i updated to macOS 10.12.2 the other day, and I had not created any project after that until now. Previously they always worked fine.
$ rails -v Rails 184.108.40.206 $ ruby -v ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
I thought i would try running
$ rails g --help and i am getting the error there too.
Running via Spring preloader in process 32228 Expected string default value for '--jbuilder'; got true (boolean) Usage: rails generate GENERATOR [args] [options] General options: -h, [--help] # Print generator's options and usage -p, [--pretend] # Run but do not make any changes -f, [--force] # Overwrite files that already exist -s, [--skip] # Skip files that already exist -q, [--quiet] # Suppress status output Please choose a generator below. Expected boolean default value for '--markerb'; got :erb (string) Expected string default value for '--helper'; got false (boolean) Expected string default value for '--assets'; got true (boolean) Rails: assets channel controller generator helper integration_test jbuilder job mailer migration model resource responders_controller scaffold scaffold_controller task ActiveRecord: active_record:devise Coffee: coffee:assets Devise: devise devise:controllers devise:install devise:views Js: js:assets Mongoid: mongoid:devise Responders: responders:install Sidekiq: sidekiq:worker TestUnit: test_unit:generator test_unit:plugin
I found these 2 issues on the rails repo which discuss this issue.
I just came across this in thor recently. I didn't have the same errors you have, but it is that latest thor release. It actually originally broke all new rails apps for a couple hours, then they released a patch, but still has issues it looks like.
These things you're seeing is probably something similar.
You could probably try setting thor in your Gemfile to "0.19.11" which was the version that wasn't causing any trouble previously.
gem "thor", "= 0.19.11"
Cool thanks Chris, that didnt work though. I am really not too sure why this is now suddenly happening.
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?
I sure hope they get these issues with thor sorted out soon
Rails shouldn't cache project names or anything. Spring might, there have been a few times recently where I noticed I had to run
spring stop to fix a couple odd bugs that seemed like things were cached when they shouldn't be.
It is odd, but least its sorted and i can now build projects again. Hopefully this will help someone else who faces the issue cause there wasnt much out there.
Trust me to run into the issue haha
Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.