aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-19 01:05:55 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-19 01:05:55 +0000
commit9723d03531ac73d5e06377f6968710d1473752ae (patch)
tree949114c8e7795326642d995be905162364544a03 /activesupport/lib/active_support/core_ext/object
parent8896efd41aca929ef91ee28a0e406bffeb253834 (diff)
downloadrails-9723d03531ac73d5e06377f6968710d1473752ae.tar.gz
rails-9723d03531ac73d5e06377f6968710d1473752ae.tar.bz2
rails-9723d03531ac73d5e06377f6968710d1473752ae.zip
Fix Object.subclasses_of to only return currently defined objects (closes #3882) [Jonathan Viney <jonathan@bluewire.net.nz>]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3607 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object')
-rw-r--r--activesupport/lib/active_support/core_ext/object/extending.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/extending.rb b/activesupport/lib/active_support/core_ext/object/extending.rb
index 8c638f83c2..9abdfc0bc9 100644
--- a/activesupport/lib/active_support/core_ext/object/extending.rb
+++ b/activesupport/lib/active_support/core_ext/object/extending.rb
@@ -8,7 +8,7 @@ class Object #:nodoc:
def subclasses_of(*superclasses)
subclasses = []
ObjectSpace.each_object(Class) do |k|
- next if (k.ancestors & superclasses).empty? || superclasses.include?(k) || k.to_s.include?("::") || subclasses.include?(k)
+ next if (k.ancestors & superclasses).empty? || superclasses.include?(k) || k.to_s.include?("::") || subclasses.include?(k) || !Object.const_defined?(k.to_s.to_sym)
subclasses << k
end
subclasses
@@ -42,4 +42,4 @@ class Object #:nodoc:
block.bind(self)[*arguments]
end
end
-end \ No newline at end of file
+end