views:

411

answers:

1

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 and f.error_messages from the dynamic_form plugin.

Thanks

+2  A: 

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
mikej
both work a treat, thank you :)
sfusion