开发者

deprecation warning in Rails

I'm a newbie to Rails and programming in general (currently learning from a book that's using 3.0.1 and ruby 1.9.2).

When I did the rake db:migrate command I got the following deprecation warning. I'm not sure if this is because I'm using a slightly older version of Rails, or if it would happen no matter what the version. Anyways, can anyone tell me what if anything I'm supposed to do now?

开发者_JAVA百科

As I am a newbie a detailed answer would be very appreciated. Cheers

$ rake db:migrate


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 SampleApp::Application#task called at /Users/michaeljohnmitchell/.rvm/gems/ruby-1.9.2-p290@rails3/gems/railties-3.0.1/lib/rails/application.rb:214:in `initialize_tasks'

Update with rakefile

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

SampleApp::Application.load_tasks


Assuming you're using Rake 0.9.x, you have two options:

  1. Upgrade to at least rails 3.0.8 (which fixes integration with Rake 0.9.x, as stated here). This can be achieved by changing your gem file to gem rails, '3.0.8' (or higher) and running bundle install.

  2. You could probably downgrade to Rake 0.8.x to fix this warning, but I highly recommend the first option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜