diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2010-06-30 23:01:30 +0100 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2010-06-30 23:01:30 +0100 |
commit | d2c633ba0bfb7baacdee89a46d7d036d24c68817 (patch) | |
tree | 8f0974852b51597652e6ae73da26f3eb80fe878b /activesupport/lib/active_support/callbacks.rb | |
parent | 92c0f17d6d2a958d3a6285b0e5408e9e0e7122e1 (diff) | |
parent | c63cf7bf0db708fe46a929cf57649ab5a92034af (diff) | |
download | rails-d2c633ba0bfb7baacdee89a46d7d036d24c68817.tar.gz rails-d2c633ba0bfb7baacdee89a46d7d036d24c68817.tar.bz2 rails-d2c633ba0bfb7baacdee89a46d7d036d24c68817.zip |
Merge branch 'master' of http://github.com/rails/rails
Diffstat (limited to 'activesupport/lib/active_support/callbacks.rb')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 3ff33eea72..c4e1eb2c04 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -1,6 +1,6 @@ +require 'active_support/descendants_tracker' require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/class/inheritable_attributes' -require 'active_support/core_ext/class/subclasses' require 'active_support/core_ext/kernel/reporting' require 'active_support/core_ext/kernel/singleton_class' @@ -85,6 +85,10 @@ module ActiveSupport module Callbacks extend Concern + included do + extend ActiveSupport::DescendantsTracker + end + def run_callbacks(kind, *args, &block) send("_run_#{kind}_callbacks", *args, &block) end @@ -428,7 +432,7 @@ module ActiveSupport options = filters.last.is_a?(Hash) ? filters.pop : {} filters.unshift(block) if block - ([self] + self.descendents).each do |target| + ([self] + self.descendants).each do |target| chain = target.send("_#{name}_callbacks") yield chain, type, filters, options target.__define_runner(name) @@ -502,7 +506,7 @@ module ActiveSupport def reset_callbacks(symbol) callbacks = send("_#{symbol}_callbacks") - self.descendents.each do |target| + self.descendants.each do |target| chain = target.send("_#{symbol}_callbacks") callbacks.each { |c| chain.delete(c) } target.__define_runner(symbol) |