【问题标题】:Can't generate a new migration in Rails无法在 Rails 中生成新的迁移
【发布时间】:2014-07-13 21:36:47
【问题描述】:

我正在尝试生成一个新的迁移以将索引添加到具有以下内容的表字段:

$ rails 生成迁移 AddIndexToUserEmail

虽然,我意外地收到以下消息

C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/formatters/b ase_formatter.rb:1:in <top (required)>': uninitialized constant RSpec::Support (NameError) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-legacy_formatters-1.0.0/l ib/rspec/legacy_formatters.rb:24:inrequire' 来自 C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-legacy_formatters-1.0.0/l ib/rspec/legacy_formatters.rb:24:in block in <top (required)>' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-legacy_formatters-1.0.0/l ib/rspec/legacy_formatters.rb:13:ineach' 来自 C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-legacy_formatters-1.0.0/l ib/rspec/legacy_formatters.rb:13:in <top (required)>' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti me.rb:81:inrequire' 来自 C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti me.rb:81:in rescue in block in require' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti me.rb:66:inblock in require' 来自 C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti me.rb:59:in each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti me.rb:59:inrequire' 来自 C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:13 2:在require' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.0.1/lib/rails/comman ds.rb:43:inrequire' 来自 C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.0.1/lib/rails/comman ds.rb:43:in <top (required)>' from bin/rails:4:inrequire' 从 bin/rails:4:in `'

我不确定这里必须理解什么,因为我在尝试使用 RSPEC 进行测试时遇到了相同的 Constant Unitinialized 错误(在我找到正确的设置之前)。 虽然这是一个不同的上下文

【问题讨论】:

    标签: ruby-on-rails-4


    【解决方案1】:

    似乎问题来自以下 gem:

    gem "rspec-legacy_formatters", :group =&gt; [:development, :test]

    不知道为什么我将它添加到 gem 文件中。我删除了它并做了一个

    $ bundle install
    

    解决了问题

    【讨论】:

      猜你喜欢
      • 2013-02-16
      • 2019-12-27
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 1970-01-01
      • 2016-05-18
      • 1970-01-01
      • 2011-07-27
      相关资源
      最近更新 更多