Global acccess to Rake DSL methods is deprecated

You may have noticed this error recently running rake db:create or rake db:migrate… The newest version of Rake (0.9+) breaks rails.

If you are getting this error: WARNING: Global access to Rake DSL methods is deprecated. Please Include ....Rake::DSL into classes and modules which use the Rake DSL methods.

There are two ways to fix this

  • The quick fix is to just downgrade to Rake 0.8.7 by doing the following:

Add the gem version to your Gemfile

gem "rake", "0.8.7"

Remove rake 0.9.1 by running

gem uninstall rake -v=0.9.1

Update rake

bundle update rake
  • The other option is to add the following to your Rakefile above the load_tasks:
module ::YourApplicationName
   class Application
    include Rake::DSL
module ::RakeFileUtils
  extend Rake::FileUtilsExt

Let me know if you’re still having problems.


02 Jun 2011