From 766195563469ce8c081a0937974e3cd2bb84f107 Mon Sep 17 00:00:00 2001 From: Bogdan Gusiev Date: Fri, 3 Feb 2012 17:57:53 +0200 Subject: AS::Callbacks: :skip_after_callbacks_if_terminated option --- activesupport/lib/active_support/callbacks.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 5eaeac2cb3..c84742054a 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -169,7 +169,7 @@ module ActiveSupport when :after <<-RUBY_EVAL #{code} - if #{@compiled_options} + if #{!chain.config[:skip_after_callbacks_if_terminated] || "!halted"} && #{@compiled_options} #{@filter} end RUBY_EVAL @@ -528,6 +528,11 @@ module ActiveSupport # other callbacks are not executed. Defaults to "false", meaning no value # halts the chain. # + # * :skip_after_callbacks_if_terminated - Determines if after callbacks should be terminated + # by the :terminator option. By default after callbacks executed no matter + # if callback chain was terminated or not. + # Option makes sence only when :terminator option is specified. + # # * :rescuable - By default, after filters are not executed if # the given block or a before filter raises an error. By setting this option # to true exception raised by given block is stored and after -- cgit v1.2.3