I am using the unscoped_associations gem in my Rails 5.0.0.1 application.
I am getting this deprecation warning:
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)
How can I silence this warning in production environment?
I have tried adding:
config.active_support.deprecation = :silence
in production.rb
But it's not working.
Place the @SuppressWarnings annotation at the declaration of the class, method, field, or local variable that uses a deprecated API. The @SuppressWarnings options are: @SuppressWarnings("deprecation") — Suppresses only the ordinary deprecation warnings.
Deprecation warnings are a common thing in our industry. They are warnings that notify us that a specific feature (e.g. a method) will be removed soon (usually in the next minor or major version) and should be replaced with something else.
The TL;DR is that you need to use RUBYOPT='-W:no-deprecated -W:no-experimental' to disable the deprecations. This will also disable experimental feature warnings as well.
With the release of Dart Sass 1.0. 0 stable last week, Ruby Sass was officially deprecated.
Per the documentation http://api.rubyonrails.org/classes/ActiveSupport/Deprecation/Behavior.html:
Setting behaviors only affects deprecations that happen after boot time. Deprecation warnings raised by gems are not affected by this setting because they happen before Rails boots up.
I did find, however, that if you set it before your gems are required, it will silence warnings.
For example, place this line:
ActiveSupport::Deprecation.behavior = :silence
before
Bundler.require(*Rails.groups)
and it should silence the gem warnings.
ActiveSupport::Deprecation.silenced = true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With