Skip to content

Commit

Permalink
dup the callback and set the chain
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 10, 2013
1 parent 2efe6ce commit 91e002e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions activesupport/lib/active_support/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 91e002e

Please sign in to comment.