Silencing Deprecation warnings in Rails 3

前端 未结 3 1483
天命终不由人
天命终不由人 2020-12-15 17:04

Can anyone tell me how to silence deprecation warinings in Rails 3?

I have a few situations where it is throwing false positives. Namely using - for loops in haml an

3条回答
  •  星月不相逢
    2020-12-15 17:28

    The accepted answer didn't work for me with Rails 3.2.12. Placing it in either the environments/production.rb or an initializer still outputted the warnings. I had to put it in my config/environment.rb file before the application was initialized:

    # Load the rails application
    require File.expand_path('../application', __FILE__)
    
    ::ActiveSupport::Deprecation.silenced = true if Rails.env.production?
    
    # Initialize the rails application
    Notices::Application.initialize!
    

提交回复
热议问题