Permalink
Browse files

dup the callback and set the chain

  • Loading branch information...
1 parent 2efe6ce commit 91e002e31eb50329a5936dab3286b41571868653 @tenderlove tenderlove committed May 10, 2013
Showing with 8 additions and 8 deletions.
  1. +8 −8 activesupport/lib/active_support/callbacks.rb
@@ -120,13 +120,12 @@ def deprecate_per_key_option(options)
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 @@ def skip_callback(name, *filter_list, &block)
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

0 comments on commit 91e002e

Please sign in to comment.