无法在Rails中生成新的迁移

时间:2014-07-13 21:36:48

标签: ruby-on-rails-4

我正在尝试生成一个新的迁移,将索引添加到表字段中,其中包含以下内容:

  

$ 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:in require'           来自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:in每个'           来自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:in require'           来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti   me.rb:81: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:in块中的'需要'           来自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:in要求'           来自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:in要求'           来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.0.1/lib/rails/comman   ds.rb:43:在<top (required)>' from bin/rails:4:in中需要'           来自bin / rails:4:在''

我不确定在这里需要理解的是因为我在尝试使用RSPEC进行测试时遇到了相同的Constant Unitinialized错误(在我找到正确的设置之前)。 虽然这是一个不同的背景

1 个答案:

答案 0 :(得分:1)

似乎问题来自以下宝石:

gem "rspec-legacy_formatters", :group => [:development, :test]

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

$ bundle install

解决了这个问题