Ruby on rails 运行rails-rake命令时,我会收到此弃用警告

Ruby on rails 运行rails-rake命令时,我会收到此弃用警告,ruby-on-rails,Ruby On Rails,刚刚创建了一个新的rails应用程序(rails 3.0.7) 每次运行rake命令时,我都会看到上面的消息 问题是什么?您安装了最新版本的Rake,它与Rails 3.0.7不兼容 将此项粘贴到您的文件中: DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /Users/bm/.rvm/gems/ruby-1.8.7-p302@global/gems/bundle

刚刚创建了一个新的rails应用程序(rails 3.0.7)

每次运行rake命令时,我都会看到上面的消息


问题是什么?

您安装了最新版本的Rake,它与Rails 3.0.7不兼容

将此项粘贴到您的文件中:

DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /Users/bm/.rvm/gems/ruby-1.8.7-p302@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:64)
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 Hs::Application#task called at /Users/bm/.rvm/gems/ruby-1.8.7-p302@hs/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
然后运行
bundle update


在那之后,调用您的rake任务前置:
bundle exec

谢谢,但是现在它说:您已经激活了rake 0.9.2,但是您的Gemfile需要rake 0.8.7。考虑使用捆绑Excel。我能解决这个问题吗?正如kain所提到的,您现在应该使用bundle exec运行您的命令。例如“bundle exec rake db:migrate”,替代方案是将rails升级到3.0.9,rake 0.9.2可以很好地使用它。
gem 'rake', '~> 0.8.7'