Problems with Rake 0.9.0 and Ruby on Rails?

Problems Rails?

If you tried to use rake in a Ruby on Rails project in the last few days, it could happen something like this:

rake aborted!
undefined method 'task' for <Your::Application:0x00000123ddd567>;

It depends on something that happened with the 0.9.0 version of Rake and you could fix it reverting to the previous version (0.8.7).

First uninstall the 0.9.0 version (maybe you should use sudo)

$ gem uninstall rake -v=0.9.0

Then specify the forced version in your Gemfile file inside your Rails application.

# Gemfile
gem 'rake', '0.8.7'

Finally update the bundle with the new (old) version of Rake.

$ bundle update rake

As a general rule, it’s advisable to specify the version of your gems inside the Gemfile, especially in production environment.

That’s all, I hope it could be useful and save your day.