未定义的方法“任务”;使用耙子 0.9.0 和 0.8.3

发布于 2024-11-09 16:56:57 字数 2028 浏览 2 评论 0原文

在尝试运行 rake 时,我遇到以下错误:

heroku rake db:migrate
耙子中止!

...以及跟踪:

> 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:

来源 'http://rubygems.org'

宝石'rails','3.0.7'
gem 'rake', '~>; 0.8.7'
gem 'sqlite3-ruby', :require =>; 'sqlite3'

我意识到其他人已经报告了此错误并提出了同样的问题 - 不过,发布的解决方案对我的问题没有影响。我尝试了此处列出的每个解决方案:未定义方法'使用 Rake 0.9.0 的“任务”

while attempting to run rake, I run into the following error:

heroku rake db:migrate
rake aborted!

...and the trace:

> 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:

source 'http://rubygems.org'

gem 'rails', '3.0.7'
gem 'rake', '~> 0.8.7'
gem 'sqlite3-ruby', :require => 'sqlite3'

I realize that other people have reported this error and asked the same question - the posted solutions have no effect on my issue, though. I've attempted every solution listed here: Undefined method 'task' using Rake 0.9.0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回首观望 2024-11-16 16:56:57

Rails 3.0.8.rc1 已使用 rake 0.9.0 修复了此问题,请参阅此提交: https://github.com/rails/rails/commit/83f257fc4862642af29056cb5b7dfef6e1303754

Rails 3.0.8.rc1 has fixed this problem with rake 0.9.0, see this commit: https://github.com/rails/rails/commit/83f257fc4862642af29056cb5b7dfef6e1303754

也只是曾经 2024-11-16 16:56:57

如果您继续使用 0.9.0,请将以下内容复制到您的 Rakefile 中:

module ::AppName
  class Application
    include Rake::DSL
  end
end

module ::RakeFileUtils
  extend Rake::FileUtilsExt
end

就在

AppName::Application.load_tasks

干杯之前,

If you keep using 0.9.0, copy the following into you're Rakefile :

module ::AppName
  class Application
    include Rake::DSL
  end
end

module ::RakeFileUtils
  extend Rake::FileUtilsExt
end

Just before

AppName::Application.load_tasks

Cheers,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文