diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 12:00:35 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 12:00:35 -0700 |
commit | 91e002e31eb50329a5936dab3286b41571868653 (patch) | |
tree | 55bf840a8e8049e40b55c21a2d14321495e767dc /activesupport | |
parent | 2efe6ce538a89c1c143d40ae5455ff85d9e21a54 (diff) | |
download | rails-91e002e31eb50329a5936dab3286b41571868653.tar.gz rails-91e002e31eb50329a5936dab3286b41571868653.tar.bz2 rails-91e002e31eb50329a5936dab3286b41571868653.zip |
dup the callback and set the chain
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index bdcc539749..b7c0f1d484 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -120,13 +120,12 @@ module ActiveSupport end end - def clone(chain) - obj = super() - obj.chain = chain - obj.options = @options.dup - obj.options[:if] = @options[:if].dup - obj.options[:unless] = @options[:unless].dup - obj + def initialize_copy(other) + super + @options = { + :if => other.options[:if].dup, + :unless => other.options[:unless].dup + } end def normalize_options!(options) @@ -493,7 +492,8 @@ module ActiveSupport filter = chain.find {|c| c.matches?(type, filter) } if filter && options.any? - new_filter = filter.clone(chain) + new_filter = filter.dup + new_filter.chain = chain chain.insert(chain.index(filter), new_filter) new_filter.recompile!(options) end |