To silence all deprecation warnings you can do:
ActiveSupport::Deprecation.silenced = true
This could be placed in an initializer or in the environment file for a specific environment (e.g. to silence only in production for example.)
Or for a specific section of code, enclose it in a block:
ActiveSupport::Deprecation.silence do
# no warnings for any use of deprecated methods here
end
This works for both Rails 3 & 4.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…