2017-01-20 11 views
4

私はRails 5.0.0.1アプリケーションでunscoped_associations gemを使用しています。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) 

がどのように私は本番環境では、この警告を消すことができます。

私はこの非推奨の警告を取得していますか?

私が追加しようとしている:

config.active_support.deprecation = :silence 

production.rbにしかし、それは働いていません。ドキュメントhttp://api.rubyonrails.org/classes/ActiveSupport/Deprecation/Behavior.htmlパー

答えて

8

ActiveSupport::Deprecation.silenced = true

3

:行動を設定

は、ブート時間の後に起こる非推奨に影響を与えます。宝石によって引き起こされる廃止警告は、Railsが起動する前に起こるため、この設定の影響を受けません。

私はあなたがそれを設定している場合前に、あなたの宝石が必要とされている、それは警告を沈黙すること、しかし、発見しました。

Bundler.require(*Rails.groups) 

ActiveSupport::Deprecation.behavior = :silence 

、それは宝石の警告を消す必要があります。

はたとえば、この行を配置します。

+1

私はあなたの答えを試してみました。それでも私は同じ非推奨の警告を受けています。 – webster

+0

http://stackoverflow.com/a/41820913/3185510ご協力いただきありがとうございます! – webster

+1

この時点までに宝石が初期化されているため、これは機能しません。これは宝石には何の影響も与えませんが、レール上では特定の警告 –

関連する問題