rake db:迁移错误,'task'未定义方法

问题描述:

已尝试运行rake db:migrate,返回错误。rake db:迁移错误,'task'未定义方法

然后用--trace再次跑了,这里是错误:

Paul-Denlingers-MacBook-Pro:things_i_bought pdenlinger$ rake db:migrate --trace 

耙中止! 未定义的方法task' for #<ThingsIBought::Application:0x00000101679880> /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:215:in initialize_tasks' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:139:in load_tasks' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:77:in method_missing的” /用户/ pdenlinger/rails_projects/things_i_bought/Rakefile:7:在<top (required)>' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in加载' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/rake_module.rb: 25:在load_rakefile' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:495:in raw_load_rakefile' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:78:in block in load_rakefile' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:129:in standard_exception_handling' /Users /pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:77:in load_rakefile' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:61:in block in run' /Users/pdenlinger/.rvm/gems /ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/ application.rb:129:在standard_exception_handling' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:59:in运行' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/bin/rake:31:in <top (required)>' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in加载' /Users /pdenlinger/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in`'

它说'任务'是一个未定义的方法;这是什么意思?我能做些什么来解决它?

Running Rails 3.0.7

+0

可能的重复[为什么我不能获取rake db:迁移到ruby.railstutorial.org工作](http://*.com/questions/6091617/why-cant-i-get -rake-dbmigrate-to-work-for-ruby-railstutorial-org) – 2011-05-29 04:27:11

+0

谢谢。我在SO上的时间一直是零星的,我并不熟悉所有的规则,但会尝试去理解它们。 – pdenlinger 2011-05-29 05:04:18

看看这个question。您可以恢复到您的Gemfile中的耙0.8.7或修补您的Rakefile。

Rake 0.9.0打破了一些东西。

在此期间,请尝试:

bundle exec rake db:migrate 

也许这会有所帮助。 - >Gist : broken rakefile