style plugins and deprecation warnings running task in Heroku

I'm upgrading to Rails 3.2, and running rake db:migrate gives me several errors of the form:

DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from at /app/Rakefile:7)

What's perplexing is that my vendor/plugins directory is empty -- is there another plugins directory that it's referencing?


Are you using Heroku?

Heroku will inject plugins in Rails 3.x applications .. To avoid this injection in Rails 3, include the rails_12factor gem in your application. (Heroku Ruby Support 2013-10-26)

The rails_12factor gem is also required in rails 4.

If this gem is not present in your application, you will receive a warning while deploying, and your assets and logs will not be functional. (Rails 4 on Heroku 2013-10-26)

As recently as 2013-08, heroku always injected plugins in rails 3 apps, even apps with the recommended gems. This was an issue with the ruby buildpack, and was fixed by PR 11, merged on 2013-08-06.


You can try

::ActiveSupport::Deprecation.silenced = true

in your production.rb since it's just noise.


in config/environment.rb add:

ActiveSupport::Deprecation.silenced = true 

before initializing rails, like so:

# Load the rails application                                                                                                                                             
require File.expand_path('../application', __FILE__)

ActiveSupport::Deprecation.silenced = true                                                                                                                               

# Initialize the rails application                                                                                                                                       
MyApp::Application.initialize!

Similarly to disable warnings in rake tasks insert the silencing config near the top of your Rakefile:

# Load the rails application                                                                                                                                             
require File.expand_path('../application', __FILE__)

ActiveSupport::Deprecation.silenced = true                                                                                                                           

# Initialize the rails application                                                                                                                                       
MyApp::Application.initialize!

You can optionally wrap this in a block to only silence in production:

if ENV['RAILS_ENV'] == "production"
  ActiveSupport::Deprecation.silenced = true
end
链接地址: http://www.djcxy.com/p/81130.html

上一篇: 不能安装宝石'推特

下一篇: 在Heroku中运行任务的风格插件和弃用警告