Rake 数据库:迁移问题
在本地运行 rake db:create 或 rake db:migrate 时,我的应用程序按预期成功构建了表。然而,当在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行。我我真的不确定发生了什么变化,但确实发生了一些变化。有没有人有过这个错误的经验?
When running rake db:create or rake db:migrate locally my app successfully builds the tables as expected. When running on heroku however (eg. heroku rake db:migrate --trace --app ) it is giving me the following error all of a sudden:
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
Looking at the Rakefile this is all that's present:
require File.expand_path('../config/application', __FILE__)
require 'rake'
Foo::Application.load_tasks
The load_tasks line is line 7. I'm really not sure what changed but something sure has. Has anyone had experience with this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅
Rake 0.9 存在问题.0。现在在 Gemfile 中使用 0.8.7。
See that
There's an issue with Rake 0.9.0. Use 0.8.7 in your Gemfile for now.