Global access to Rake DSL methods is deprecated

chell picture chell · Jun 1, 2011 · Viewed 22.6k times · Source

I am working through the Ruby on Rails 3 tutorial book and typed the following on the command line:

rake db:migrate

which produced the following warning.

WARNING: Global access to Rake DSL methods is deprecated.  Please Include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.

WARNING: DSL method DemoApp::Application#task called at /Users/imac/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'

I am not sure what to do about it or how to work with it. I don't know any other command for Rake.

How can I fix this problem?

Answer

Patelify picture Patelify · Jun 11, 2011

Adding include Rake::DSL to the Rakefile before the applications load_tasks were called also worked for me.

So in the above user's case before the DemoApp::Application.load_tasks in the Rakefile.