在尝试运行rake时,遇到以下错误:
heroku rake db:迁移
耙子流产!
...和跟踪:
> undefined method `task' for # > /app/.bundle/gems/ruby/1.8/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks' > /app/.bundle/gems/ruby/1.8/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks' > /app/.bundle/gems/ruby/1.8/gems/railties-3.0.7/lib/rails/application.rb:77:in `send' > /app/.bundle/gems/ruby/1.8/gems/railties-3.0.7/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
的Gemfile:
gem'rail','3.0.7'
宝石'耙','〜> 0.8.7'
gem'sqlite3-ruby',:require => 'sqlite3的'
我意识到其他人已经报告了这个错误并提出了同样的问题 - 发布的解决方案对我的问题没有影响。我尝试过这里列出的每个解决方案:Undefined method 'task' using Rake 0.9.0。
答案 0 :(得分:1)
如果你继续使用0.9.0,请将以下内容复制到你的Rakefile:
module ::AppName
class Application
include Rake::DSL
end
end
module ::RakeFileUtils
extend Rake::FileUtilsExt
end
就在
之前AppName::Application.load_tasks
干杯,
答案 1 :(得分:1)
Rails 3.0.8.rc1已经使用rake 0.9.0解决了这个问题,请参阅此提交:https://github.com/rails/rails/commit/83f257fc4862642af29056cb5b7dfef6e1303754