From a213ac360f104d7ba6e9395cd9fdcb8e212a054e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 18 May 2018 13:35:09 -0400 Subject: Raise a better exception when a invalid depreation behavior is set Fixes #32928. --- activesupport/lib/active_support/deprecation/behaviors.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/lib/active_support/deprecation/behaviors.rb') diff --git a/activesupport/lib/active_support/deprecation/behaviors.rb b/activesupport/lib/active_support/deprecation/behaviors.rb index 66d6f3225a..3abd25aa85 100644 --- a/activesupport/lib/active_support/deprecation/behaviors.rb +++ b/activesupport/lib/active_support/deprecation/behaviors.rb @@ -94,6 +94,10 @@ module ActiveSupport private def arity_coerce(behavior) + unless behavior.respond_to?(:call) + raise ArgumentError, "#{behavior.inspect} is not a valid deprecation behavior." + end + if behavior.arity == 4 || behavior.arity == -1 behavior else -- cgit v1.2.3