【问题标题】:rake db:migrate error, 'task' is undefined methodrake db:迁移错误,“任务”是未定义的方法
【发布时间】:2011-09-04 04:31:11
【问题描述】:

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

然后用--trace再次运行它,这是错误:

Paul-Denlingers-MacBook-Pro:things_i_bought pdenlinger$ rake db:migrate --trace

rake 中止! 未定义的方法task' for #<ThingsIBought::Application:0x00000101679880> /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:215:ininitialize_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:inmethod_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:inload' /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:inraw_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:instandard_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:inblock in run' /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:inrun' /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:inload' /Users/pdenlinger/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `'

它说'task'是一个未定义的方法;这是什么意思?我能做些什么来解决它?

运行 Rails 3.0.7

【问题讨论】:

标签: ruby-on-rails-3


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    也许这会有所帮助。 ->Gist : broken rakefile

    【讨论】:

      【解决方案3】:

      Rake 0.9.0 破坏了一些东西。

      与此同时,尝试:

      bundle exec rake db:migrate
      

      【讨论】:

        猜你喜欢
        • 2011-09-07
        • 1970-01-01
        • 2014-05-19
        • 2019-08-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-22
        相关资源
        最近更新 更多