mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
dup the callback and set the chain
This commit is contained in:
parent
2efe6ce538
commit
91e002e31e
1 changed files with 8 additions and 8 deletions
|
@ -120,13 +120,12 @@ module ActiveSupport
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def clone(chain)
|
def initialize_copy(other)
|
||||||
obj = super()
|
super
|
||||||
obj.chain = chain
|
@options = {
|
||||||
obj.options = @options.dup
|
:if => other.options[:if].dup,
|
||||||
obj.options[:if] = @options[:if].dup
|
:unless => other.options[:unless].dup
|
||||||
obj.options[:unless] = @options[:unless].dup
|
}
|
||||||
obj
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize_options!(options)
|
def normalize_options!(options)
|
||||||
|
@ -493,7 +492,8 @@ module ActiveSupport
|
||||||
filter = chain.find {|c| c.matches?(type, filter) }
|
filter = chain.find {|c| c.matches?(type, filter) }
|
||||||
|
|
||||||
if filter && options.any?
|
if filter && options.any?
|
||||||
new_filter = filter.clone(chain)
|
new_filter = filter.dup
|
||||||
|
new_filter.chain = chain
|
||||||
chain.insert(chain.index(filter), new_filter)
|
chain.insert(chain.index(filter), new_filter)
|
||||||
new_filter.recompile!(options)
|
new_filter.recompile!(options)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue