24

Recently I've created an app for Ruby (2.3.3) on Rails (5.0.0.1):

$ rails _5.0.0.1_ new myapp --database=postgresql -T

After setting up the Gemfile and testing the connectivity to my databases:

$ rails db:migrate

I've tried to generate models but I got strange messages:

$ rails g model Competition title:string
Expected string default value for '--test-framework'; got false (boolean)
Expected string default value for '--jbuilder'; got true (boolean)
Expected string default value for '--test-framework'; got false (boolean)
      invoke  active_record
      create    db/migrate/20161206021603_create_competitions.rb
      create    app/models/competition.rb

What's the meaning of these messages about "Expected string default value for ..."?

Thanks in advance.

UPDATE: My Gemfile

source 'https://rubygems.org'

ruby '2.3.3'

gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'

gem 'jquery-turbolinks'
gem 'groupdate'
gem 'hightop'
gem 'countries'
gem 'faker'
gem 'haml'
gem 'haml-rails'

group :development, :test do
    gem 'byebug', platform: :mri
    gem 'better_errors'
    gem 'binding_of_caller'
    gem 'pry-byebug'
    gem 'awesome_print'
    gem 'irbtools-more', require: 'irbtools/binding'
    gem 'listen'
end
  • I am experiencing similar behavior with ruby 2.3.1 and rails 5.0.0.1 running rails generate model with everything set as default: Running via Spring preloader in process 11594 Expected string default value for '--jbuilder'; got true (boolean) – Carlos Goce Dec 06 '16 at 10:39
  • I think these messages are likely caused by Rails 5.0.0.1 – Ουιλιαμ Αρκευα Dec 07 '16 at 22:09
  • I changed to Ruby 2.2.5 and I am not having those issues anymore – Carlos Goce Dec 07 '16 at 22:54
  • The [changelog notes](https://github.com/erikhuda/thor/blob/master/CHANGELOG.md) on the [github for Thor](https://github.com/erikhuda/thor) might be useful to you, Njoy! – MmmHmm Dec 25 '16 at 21:21

1 Answers1

52

This happened to me with Rails 5.0.0.1 and ruby 2.2.0 when I performed a bundle update. It has nothing to do with either Rails or Ruby, but was instead caused by the upgrade of the thor gem (which is a dependency of jquery-rails, among others) from 0.19.1 to 0.19.4.

Downgrading to 0.19.3 didn't fix it. 0.19.2 threw other errors. Downgrading to 0.19.1 finally fixed it.

So adding this to your Gemfile:

gem 'thor', '0.19.1'

and running bundle update thor should get rid of this until the thor maintainers can address this. (Update: Github issue)

Thilo
  • 17,565
  • 5
  • 68
  • 84
  • I don't use that gem, but version of gems could be the tip to resolve why these messages. – Ουιλιαμ Αρκευα Dec 08 '16 at 14:38
  • 4
    Most people don't use it directly, I assume - but check your `Gemfile.lock`, chances are you do use it implicitly. – Thilo Dec 08 '16 at 14:50
  • You are right, those messages are not displayed anymore. But my initial question has not been responded yet: What's the meaning of those messages? Are they errors, warnings, or simple texts that should not be displayed? – Ουιλιαμ Αρκευα Dec 08 '16 at 15:16
  • 1
    They're warnings, but I wouldn't ignore them. They indicate that the default values of those options for the `rails g model` command are being incorrectly overwritten, which might have strange consequences. You can see what the *actual* default values should be by running `rails g model --help`. – Thilo Dec 08 '16 at 21:51