diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2012-02-22 17:43:13 +0200 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2012-02-22 17:43:13 +0200 |
commit | 10bac29b330ddda69102d43b77a1e7dba8741c45 (patch) | |
tree | d7fcc8b8ff486b59e3694e8e25b1f9e45be969e1 /activesupport/lib | |
parent | 157ea763060e90f3aba0ff5af15d5dcb0f0c9c35 (diff) | |
download | rails-10bac29b330ddda69102d43b77a1e7dba8741c45.tar.gz rails-10bac29b330ddda69102d43b77a1e7dba8741c45.tar.bz2 rails-10bac29b330ddda69102d43b77a1e7dba8741c45.zip |
AS::Callbacks: deprecate rescuable option
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 6de49409e5..6e36edee4f 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -307,7 +307,6 @@ module ActiveSupport @name = name @config = { :terminator => "false", - :rescuable => false, :scope => [ :kind ] }.merge(config) end @@ -317,35 +316,16 @@ module ActiveSupport method << "value = nil" method << "halted = false" - callbacks = yielding + callbacks = "value = yield if block_given? && !halted" reverse_each do |callback| callbacks = callback.apply(callbacks) end method << callbacks - method << "raise rescued_error if rescued_error" if config[:rescuable] method << "halted ? false : (block_given? ? value : true)" method.flatten.compact.join("\n") end - # Returns part of method that evaluates the callback block - def yielding - method = [] - if config[:rescuable] - method << "rescued_error = nil" - method << "begin" - end - - method << "value = yield if block_given? && !halted" - - if config[:rescuable] - method << "rescue Exception => e" - method << "rescued_error = e" - method << "end" - end - method.join("\n") - end - end module ClassMethods @@ -508,11 +488,6 @@ module ActiveSupport # if callback chain was terminated or not. # Option makes sence only when <tt>:terminator</tt> option is specified. # - # * <tt>:rescuable</tt> - By default, after filters are not executed if - # the given block or a before filter raises an error. By setting this option - # to <tt>true</tt> exception raised by given block is stored and after - # executing all the after callbacks the stored exception is raised. - # # * <tt>:scope</tt> - Indicates which methods should be executed when an object # is used as a callback. # |