aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorclaudiob <claudiob@gmail.com>2014-10-16 16:21:24 -0700
committerclaudiob <claudiob@gmail.com>2015-01-02 15:31:55 -0800
commit2386daabe7f8c979b453010dc0de3e1f6bbf859d (patch)
tree74ab7a4ffc32cda7126e3ce8950d21af0c4c4b90 /actionpack/lib
parent93dd5028a0cd0363d9f4bfc97d9ce70f0f3e88c8 (diff)
downloadrails-2386daabe7f8c979b453010dc0de3e1f6bbf859d.tar.gz
rails-2386daabe7f8c979b453010dc0de3e1f6bbf859d.tar.bz2
rails-2386daabe7f8c979b453010dc0de3e1f6bbf859d.zip
Throw :abort halts default CallbackChains
This commit changes arguments and default value of CallbackChain's :terminator option. After this commit, Chains of callbacks defined **without** an explicit `:terminator` option will be halted as soon as a `before_` callback throws `:abort`. Chains of callbacks defined **with** a `:terminator` option will maintain their existing behavior of halting as soon as a `before_` callback matches the terminator's expectation. For instance, ActiveModel's callbacks will still halt the chain when a `before_` callback returns `false`.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/abstract_controller/callbacks.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb
index ca5c80cd71..60604db447 100644
--- a/actionpack/lib/abstract_controller/callbacks.rb
+++ b/actionpack/lib/abstract_controller/callbacks.rb
@@ -9,7 +9,7 @@ module AbstractController
included do
define_callbacks :process_action,
- terminator: ->(controller,_) { controller.response_body },
+ terminator: ->(controller, result_lambda) { result_lambda.call if result_lambda.is_a?(Proc); controller.response_body },
skip_after_callbacks_if_terminated: true
end