“...的预期字符串默认值"的含义;在 Ruby on Rails 上 [英] Meaning of "Expected string default value for ..." on Ruby on Rails

查看:49
本文介绍了“...的预期字符串默认值"的含义;在 Ruby on Rails 上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我在 Rails (5.0.0.1) 上为 Ruby (2.3.3) 创建了一个应用程序:

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

设置 Gemfile 并测试与我的数据库的连接后:

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

这些关于Expected string default value for ..."的消息是什么意思?

提前致谢.

更新:我的 Gemfile

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

推荐答案

当我执行 bundle update 时,Rails 5.0.0.1 和 ruby​​ 2.2.0 发生了这种情况.它与 Rails 或 Ruby 无关,而是由 thor gem(它是jquery-rails 等)从 0.19.1 到 0.19.4.

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.

降级到 0.19.3 并没有修复它.0.19.2 引发了其他错误.降级到 0.19.1 终于解决了.

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

因此将其添加到您的 Gemfile 中:

So adding this to your Gemfile:

gem 'thor', '0.19.1'

并运行 bundle update thor 应该摆脱这个,直到 thor 维护者可以解决这个问题.(更新:Github 问题)

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

这篇关于“...的预期字符串默认值"的含义;在 Ruby on Rails 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆