运行rake db:create或rake db:在本地迁移时,我的应用程序按预期成功构建了表。但是当在heroku上运行时(例如,heroku rake db:migrate --trace --app)它会突然给我以下错误:
C:\>heroku rake db:migrate --trace --app foo rake aborted!
undefined method `task' for #<Foo::Application:0x7f8e77aa1420>
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:139:in `load_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
/app/Rakefile:7
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:78:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:61:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/bin/rake:31
/usr/ruby1.8.7/bin/rake:19:in `load'
/usr/ruby1.8.7/bin/rake:19
查看Rakefile,这就是现在的全部内容:
require File.expand_path('../config/application', __FILE__)
require 'rake'
Foo::Application.load_tasks
load_tasks行是第7行。我真的不确定发生了什么变化,但肯定有。有没有人遇到过这个错误?