diff options
author | Iain Beeston <iain.beeston@gmail.com> | 2015-02-21 14:37:07 +0000 |
---|---|---|
committer | Iain Beeston <iain.beeston@gmail.com> | 2015-04-03 09:37:19 +0100 |
commit | d2876141d08341ec67cf6a11a073d1acfb920de7 (patch) | |
tree | 4d69bd159f9c16acb328adb680a090fc9f49470e /actionpack/lib | |
parent | a05f3e5f96f7a8aa55483d91becdbe49b81833fd (diff) | |
download | rails-d2876141d08341ec67cf6a11a073d1acfb920de7.tar.gz rails-d2876141d08341ec67cf6a11a073d1acfb920de7.tar.bz2 rails-d2876141d08341ec67cf6a11a073d1acfb920de7.zip |
Raise ArgumentError if an unrecognised callback is skipped
At present, if you skip a callback that hasn't been defined,
activesupport callbacks silently does nothing. However, it's easy to
mistype the name of a callback and mistakenly think that it's being
skipped, when it is not.
This problem even exists in the current test suite.
CallbacksTest::SkipCallbacksTest#test_skip_person attempts to skip
callbacks that were never set up.
This PR changes `skip_callback` to raise an `ArgumentError` if the
specified callback cannot be found.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/abstract_controller/callbacks.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb index 59ffb0a19e..13795f0dd8 100644 --- a/actionpack/lib/abstract_controller/callbacks.rb +++ b/actionpack/lib/abstract_controller/callbacks.rb @@ -62,9 +62,9 @@ module AbstractController # using #skip_action_callback def skip_action_callback(*names) ActiveSupport::Deprecation.warn('`skip_action_callback` is deprecated and will be removed in the next major version of Rails. Please use skip_before_action, skip_after_action or skip_around_action instead.') - skip_before_action(*names) - skip_after_action(*names) - skip_around_action(*names) + skip_before_action(*names, raise: false) + skip_after_action(*names, raise: false) + skip_around_action(*names, raise: false) end def skip_filter(*names) |