web*_*ter 6 ruby ruby-on-rails ruby-on-rails-5
我在我的Rails 5.0.0.1应用程序中使用unscoped_associations gem.
我收到这个弃用警告:
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /home/rhl/myapp/config/application.rb:8)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /home/rhl/myapp/config/application.rb:8)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /home/rhl/myapp/config/application.rb:8)
Run Code Online (Sandbox Code Playgroud)
如何在生产环境中消除此警告?
我试过添加:
config.active_support.deprecation = :silence
Run Code Online (Sandbox Code Playgroud)
在 production.rb
但它不起作用.
根据文档http://api.rubyonrails.org/classes/ActiveSupport/Deprecation/Behavior.html:
设置行为仅影响启动后发生的弃用。gems 引发的弃用警告不受此设置的影响,因为它们发生在 Rails 启动之前。
但是,我确实发现,如果您在需要宝石之前设置它,它将使警告静音。
例如,放置这一行:
ActiveSupport::Deprecation.behavior = :silence
Run Code Online (Sandbox Code Playgroud)
前
Bundler.require(*Rails.groups)
Run Code Online (Sandbox Code Playgroud)
它应该使 gem 警告静音。
| 归档时间: |
|
| 查看次数: |
3401 次 |
| 最近记录: |