From 63c8ea9a6a28ecaabb236dae094d99d9d1ee2ecd Mon Sep 17 00:00:00 2001 From: Rolf Timmermans Date: Sat, 12 Mar 2011 14:24:36 +0100 Subject: adds a couple of missing AS dependencies --- activesupport/lib/active_support/callbacks.rb | 1 + activesupport/lib/active_support/core_ext/module/deprecation.rb | 2 ++ 2 files changed, 3 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index b531a094cf..a7a7836f03 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -1,3 +1,4 @@ +require 'active_support/concern' require 'active_support/descendants_tracker' require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/class/attribute' diff --git a/activesupport/lib/active_support/core_ext/module/deprecation.rb b/activesupport/lib/active_support/core_ext/module/deprecation.rb index 5a5b4e3f80..9c169a2598 100644 --- a/activesupport/lib/active_support/core_ext/module/deprecation.rb +++ b/activesupport/lib/active_support/core_ext/module/deprecation.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation' + class Module # Declare that a method has been deprecated. # deprecate :foo -- cgit v1.2.3 From 46f6a2e3889bae420589f429b09722a37dbdf18d Mon Sep 17 00:00:00 2001 From: Rolf Timmermans Date: Sat, 12 Mar 2011 23:49:25 +0800 Subject: It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free. --- activesupport/lib/active_support/descendants_tracker.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/descendants_tracker.rb b/activesupport/lib/active_support/descendants_tracker.rb index 4d1cfacc95..e2a8b4d4e3 100644 --- a/activesupport/lib/active_support/descendants_tracker.rb +++ b/activesupport/lib/active_support/descendants_tracker.rb @@ -1,5 +1,3 @@ -require 'active_support/dependencies' - module ActiveSupport # This module provides an internal implementation to track descendants # which is faster than iterating through ObjectSpace. @@ -18,12 +16,16 @@ module ActiveSupport end def self.clear - @@direct_descendants.each do |klass, descendants| - if ActiveSupport::Dependencies.autoloaded?(klass) - @@direct_descendants.delete(klass) - else - descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) } + if defined? ActiveSupport::Dependencies + @@direct_descendants.each do |klass, descendants| + if ActiveSupport::Dependencies.autoloaded?(klass) + @@direct_descendants.delete(klass) + else + descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) } + end end + else + @@direct_descendants.clear end end -- cgit v1.2.3 From 1a3fe8ce42e202630e6b1d8cf7137002e270ebdb Mon Sep 17 00:00:00 2001 From: Rolf Timmermans Date: Sat, 12 Mar 2011 23:05:52 +0800 Subject: Prevent callbacks in child classes from being executed more than once. --- activesupport/lib/active_support/callbacks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index a7a7836f03..418102352f 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -416,7 +416,7 @@ module ActiveSupport options = filters.last.is_a?(Hash) ? filters.pop : {} filters.unshift(block) if block - ([self] + ActiveSupport::DescendantsTracker.descendants(self)).each do |target| + ([self] + ActiveSupport::DescendantsTracker.descendants(self)).reverse.each do |target| chain = target.send("_#{name}_callbacks") yield target, chain.dup, type, filters, options target.__define_runner(name) -- cgit v1.2.3 From 9f5b1e1ed08df9dbedded0a6b7798d919d43b9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 13 Mar 2011 08:35:50 +0100 Subject: Revert "It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free." This reverts commit 46f6a2e3889bae420589f429b09722a37dbdf18d. Caused failures on CI. rake test:isolated on activesupport directory show them. --- activesupport/lib/active_support/descendants_tracker.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/descendants_tracker.rb b/activesupport/lib/active_support/descendants_tracker.rb index e2a8b4d4e3..4d1cfacc95 100644 --- a/activesupport/lib/active_support/descendants_tracker.rb +++ b/activesupport/lib/active_support/descendants_tracker.rb @@ -1,3 +1,5 @@ +require 'active_support/dependencies' + module ActiveSupport # This module provides an internal implementation to track descendants # which is faster than iterating through ObjectSpace. @@ -16,16 +18,12 @@ module ActiveSupport end def self.clear - if defined? ActiveSupport::Dependencies - @@direct_descendants.each do |klass, descendants| - if ActiveSupport::Dependencies.autoloaded?(klass) - @@direct_descendants.delete(klass) - else - descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) } - end + @@direct_descendants.each do |klass, descendants| + if ActiveSupport::Dependencies.autoloaded?(klass) + @@direct_descendants.delete(klass) + else + descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) } end - else - @@direct_descendants.clear end end -- cgit v1.2.3