gpt4 book ai didi

ruby-on-rails - ActiveSupport::Deprecation.silenced = true 对我不起作用?

转载 作者:行者123 更新时间:2023-12-04 03:44:32 26 4
gpt4 key购买 nike

我的应用程序是使用 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在下一个主要版本中。见 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正如警告所暗示的那样。 Mwah mwah 关于长期忽略警告等的建议。

关于ruby-on-rails - ActiveSupport::Deprecation.silenced = true 对我不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9126331/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com