Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top