Turning Rails deprecation warnings into errors
November 22nd, 2007
Rails deprecations are a nice thing. They allow us to know what transition path to use, instead of being left in the dark. With deprecated functionality being removed from Rails, it’s important to know these things.
If you have a decent test coverage, you might want to add this to your config/environments/test.rb:
1 2 3 4 |
class DeprecatedFunctionality < SyntaxError; end ActiveSupport::Deprecation.behavior = Proc.new {|message, callstack| raise DeprecatedFunctionality, message } |
This will raise an exception instead of simply reporting the warning to the console. If you have CruiseControl.rb installed, the messages will show up as errors there too. This is a quick and easy way to force yourself to actually use the new functionality.