耙子流产了! nil的未定义方法“先决条件”:NilClass

时间:2012-01-13 23:00:58

标签: ruby-on-rails ruby rake

剧透:这是rspec-rails宝石的过时版本!

在将我的sqlite3 gem移动到开发块然后运行'rake db:migrate'以确保一切仍然有效之后,我从rails项目目录发出的任何rake命令都遇到此错误。 Rake在我的系统的其他地方工作正常。但是我在该目录中运行的任何rake任务都为我提供了跟踪输出:

/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec/rails/tasks/rspec.rake:3:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `block in <class:Railtie>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `call'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application.rb:103:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/ianyoung/rails/third_app/Rakefile:7:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'

我得到的第一个错误是问题标题: 耙子流产了! nil的未定义方法“先决条件”:NilClass

我也得到了这个,但它并没有给我带来麻烦。也许它是相关的?:

  

DEPRECATION WARNING:不推荐使用Rails :: Railtie中的config.generators。请改用config.app_generators。 (来自/Users/ianyoung/rails/third_app/config/application.rb:13)   弃用警告:不推荐使用Rails :: Railtie中的config.generators。请改用config.app_generators。 (来自/Users/ianyoung/rails/third_app/config/application.rb:13)

1 个答案:

答案 0 :(得分:3)

更新到最新的rspec-rails gem让我解除了这个问题以及弃用警告。

安装最新的webrat gem解决了缺少的has_selector?我出于某种原因认为的方法问题比我过时的rspec-rails gem更邪恶。一切都很好。

感谢您提供的有用评论。