gpt4 book ai didi

ruby - 为什么我不能得到 rake db :migrate to work for ruby. railstutorial.org

转载 作者:数据小太阳 更新时间:2023-10-29 07:42:13 25 4
gpt4 key购买 nike

我决定完成教程。在我创建一个新的应用程序并添加新的 user:string email:string 然后在应用程序目录中执行 rake db:migrate 之后,我得到了这个输出:

rake aborted! 
undefined method `task' for #<DemoApp::Application:0x00000100e49e08>
/usr/local/rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/Users/zigloo99/rails_projects/demo_app/Rakefile:7:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:78:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:61:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.0/bin/rake:31:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180@global/bin/rake:19:in `<main>'

我也在教程中使用 RVM ruby​​ 1.9.2 和 rails 3.0.7。有什么想法吗?

最佳答案

发生这种情况是因为最新版本的 Rake (0.9.0) 在 Rails 3.0 应用程序上损坏,我们目前正在等待可靠的修复。

现在,解决此错误的一种方法是将此行添加到应用程序 Rakefile 中的 load_tasks 行之上:

<AppName>::Application.send :include, ::Rake::DSL if defined?(::Rake::DSL)

关于ruby - 为什么我不能得到 rake db :migrate to work for ruby. railstutorial.org,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6091617/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com