diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-04 06:01:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-04 06:01:28 +0000 |
commit | a6a683b0bb7c6019ed38b5d1bba1dac4594dc5da (patch) | |
tree | 8c86f7e9a7f481db83cbd6f68f72d13568a54d5d /activesupport/lib/active_support/core_ext | |
parent | 38aae1b122325816592cc9cc4c31e35bad38cd1f (diff) | |
download | rails-a6a683b0bb7c6019ed38b5d1bba1dac4594dc5da.tar.gz rails-a6a683b0bb7c6019ed38b5d1bba1dac4594dc5da.tar.bz2 rails-a6a683b0bb7c6019ed38b5d1bba1dac4594dc5da.zip |
Fixed Class.remove to not blow up on inheritance
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3532 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/removal.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/removal.rb b/activesupport/lib/active_support/core_ext/class/removal.rb index 42cb9f6e4e..628781669d 100644 --- a/activesupport/lib/active_support/core_ext/class/removal.rb +++ b/activesupport/lib/active_support/core_ext/class/removal.rb @@ -11,12 +11,12 @@ class Class #:nodoc: klasses.each do |klass| # Skip this class if there is nothing bound to this name next unless defined?(klass.name) - + basename = klass.to_s.split("::").last parent = klass.parent - + # Skip this class if it does not match the current one bound to this name - next unless klass = parent.const_get(basename) + next unless parent.const_defined?(basename) && klass = parent.const_get(basename) parent.send :remove_const, basename unless parent == klass end |