rake db:migrate error,'task'是未定义的方法

时间:2011-05-29 04:23:57

标签: ruby-on-rails-3

尝试运行rake db:migrate,返回错误。

然后用--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' / Users / pdenlinger / rails_projects / things_i_bought / Rakefile:7:in <top (required)>' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in load' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in 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阻止运行' /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:59:in run' /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 load' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in`'

它说“任务”是一种未定义的方法;这是什么意思?我该怎么做才能解决它?

运行Rails 3.0.7

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

也许这会有所帮助。 - &GT; Gist : broken rakefile

答案 2 :(得分:-1)

Rake 0.9.0打破了一些事情。

在此期间,请尝试:

bundle exec rake db:migrate