Browse files

only dup the options once, the Callback object does not mutate them

  • Loading branch information...
1 parent 132db31 commit dd03f10d5258dab75da6b7ec493e6558b4ed2bac @tenderlove tenderlove committed May 14, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 activesupport/lib/active_support/callbacks.rb
View
4 activesupport/lib/active_support/callbacks.rb
@@ -585,7 +585,7 @@ def normalize_callback_params(name, filters, block) # :nodoc:
type = CALLBACK_FILTER_TYPES.include?(filters.first) ? filters.shift : :before
options = filters.last.is_a?(Hash) ? filters.pop : {}
filters.unshift(block) if block
- [type, filters, options]
+ [type, filters, options.dup]
end
# This is used internally to append, prepend and skip callbacks to the
@@ -636,7 +636,7 @@ def set_callback(name, *filter_list, &block)
type, filters, options = normalize_callback_params(name, filter_list, block)
self_chain = get_callbacks name
mapped = filters.map do |filter|
- Callback.build(self_chain, filter, type, options.dup)
+ Callback.build(self_chain, filter, type, options)
end
__update_callbacks(name) do |target, chain|

0 comments on commit dd03f10

Please sign in to comment.