Meaning of "Expected string default value for ..." on Ruby on Rails

Ουιλιαμ Αρκευα picture Ουιλιαμ Αρκευα · Dec 6, 2016 · Viewed 11k times · Source

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

Answer

Thilo picture Thilo · Dec 8, 2016

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)