From 91e002e31eb50329a5936dab3286b41571868653 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 10 May 2013 12:00:35 -0700 Subject: dup the callback and set the chain --- activesupport/lib/active_support/callbacks.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activesupport') 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 -- cgit v1.2.3