diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-05-18 13:35:09 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-05-18 13:35:09 -0400 |
commit | a213ac360f104d7ba6e9395cd9fdcb8e212a054e (patch) | |
tree | 55cbd1753aee6a498d25eebb2b0fdf90d8a20548 /activesupport/lib/active_support | |
parent | 9f95767979579f5761cb0d2bcccb67f3662349c5 (diff) | |
download | rails-a213ac360f104d7ba6e9395cd9fdcb8e212a054e.tar.gz rails-a213ac360f104d7ba6e9395cd9fdcb8e212a054e.tar.bz2 rails-a213ac360f104d7ba6e9395cd9fdcb8e212a054e.zip |
Raise a better exception when a invalid depreation behavior is set
Fixes #32928.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/deprecation/behaviors.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |