问题
My app was developed using Ruby 1.8.7 and Rails 2.3.11.
I am getting lot of deprecation warning while running 'rake spec'
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from load_paths at /home/soundarapandian/.rvm/gems/ruby-1.8.7-p352/gems/desert-0.5.2/lib/desert/manager.rb:36)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from load_paths at /home/soundarapandian/.rvm/gems/ruby-1.8.7-p352/gems/desert-0.5.2/lib/desert/manager.rb:36)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from load_paths at /home/soundarapandian/.rvm/gems/ruby-1.8.7-p352/gems/desert-0.5.2/lib/desert/manager.rb:36)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from load_paths at /home/soundarapandian/.rvm/gems/ruby-1.8.7-p352/gems/desert-0.5.2/lib/desert/manager.rb:36)
config.load_paths is deprecated and removed in Rails 3, please use autoload_paths instead
config.load_paths= is deprecated and removed in Rails 3, please use autoload_paths= instead
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from load_paths at /home/soundarapandian/.rvm/gems/ruby-1.8.7-p352/gems/desert-0.5.2/lib/desert/manager.rb:36)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from load_paths at /home/soundarapandian/.rvm/gems/ruby-1.8.7-p352/gems/desert-0.5.2/lib/desert/manager.rb:36)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use
I have tried adding
ActiveSupport::Deprecation.silenced = true
#in config/environments/test.rb
But still I am getting the warnings.How can I disable it?
Thank you.
回答1:
Looks like it will be config.activesupport.deprecation = :silence
in the next major release. See https://github.com/rails/rails/pull/5986.
Note that you could add
ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:silence] = Proc.new { |message, callstack| }
to your app now as @carlosantoniodasilva mentions in the middle of the comments to get the :silence
behaviour.
Popping the stack, though, the eat-your-broccoli answer would be to fix the deprecation warnings by changing over your config.load_paths
calls in config/application.rb
and elsewhere to config.autoload_paths
as the warnings suggest. Mwah mwah advice about ignoring warnings over the long term, etc.
来源:https://stackoverflow.com/questions/9126331/activesupportdeprecation-silenced-true-does-not-works-for-me