diff options
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index cece3eb19f..de42a075e1 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -806,30 +806,30 @@ module ActiveSupport def define_callbacks(*names) options = names.extract_options! - ([self] + ActiveSupport::DescendantsTracker.descendants(self)).each do |target| - names.each do |name| - name = name.to_sym + names.each do |name| + name = name.to_sym + ([self] + ActiveSupport::DescendantsTracker.descendants(self)).each do |target| target.set_callbacks name, CallbackChain.new(name, options) + end - target.module_eval <<-RUBY, __FILE__, __LINE__ + 1 - def _run_#{name}_callbacks(&block) - run_callbacks #{name.inspect}, &block - end + module_eval <<-RUBY, __FILE__, __LINE__ + 1 + def _run_#{name}_callbacks(&block) + run_callbacks #{name.inspect}, &block + end - def self._#{name}_callbacks - get_callbacks(#{name.inspect}) - end + def self._#{name}_callbacks + get_callbacks(#{name.inspect}) + end - def self._#{name}_callbacks=(value) - set_callbacks(#{name.inspect}, value) - end + def self._#{name}_callbacks=(value) + set_callbacks(#{name.inspect}, value) + end - def _#{name}_callbacks - __callbacks[#{name.inspect}] - end - RUBY - end + def _#{name}_callbacks + __callbacks[#{name.inspect}] + end + RUBY end end |