ActiveSupport :: Deprecation.silenced = true对我不起作用?

我的应用程序是使用Ruby 1.8.7和Rails 2.3.11开发的。

运行’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 

我试过添加

 ActiveSupport::Deprecation.silenced = true #in config/environments/test.rb 

但我仍然收到警告。如何禁用它?

谢谢。

看起来它将是config.activesupport.deprecation = :silence在下一个主要版本中config.activesupport.deprecation = :silence 。 请参阅https://github.com/rails/rails/pull/5986 。

请注意,您可以添加

 ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:silence] = Proc.new { |message, callstack| } 

现在你的应用程序@carlosantoniodasilva在评论中提到:silence行为。

然而,弹出堆栈,吃西兰花的答案就是通过将config/application.rb config.load_paths调用和其他地方的config.autoload_paths为警告提示来修复弃用警告。 关于忽视长期警告等的Mwah mwah建议