我的应用程序是使用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
但我仍然收到警告。如何禁用它?
谢谢。
答案 0 :(得分:4)
在下一个主要版本中看起来会config.activesupport.deprecation = :silence
。请参阅https://github.com/rails/rails/pull/5986。
请注意,您可以添加
ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:silence] = Proc.new { |message, callstack| }
到你的应用程序现在@carlosantoniodasilva在评论中间提到获得:silence
行为。
弹出堆栈,吃西兰花的答案是通过将config.load_paths
和config/application.rb
中的config.autoload_paths
来电更改为{{1}}作为警告来修复弃用警告建议。关于忽视长期警告等的Mwah mwah建议