diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-12-19 19:47:21 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-12-19 19:47:21 +0000 |
commit | 7277c518912e08d125cef0f0a890a72bd7283cf5 (patch) | |
tree | f5f1a0dea237bae22ceeb157186d517ee882e06a | |
parent | 8732ce291b6048a4eb80748ea3f404f495b7104c (diff) | |
download | rails-7277c518912e08d125cef0f0a890a72bd7283cf5.tar.gz rails-7277c518912e08d125cef0f0a890a72bd7283cf5.tar.bz2 rails-7277c518912e08d125cef0f0a890a72bd7283cf5.zip |
Partially revert [5660] - makes more trouble than it resolves. References #5704, closes #6766.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5753 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 7 | ||||
-rwxr-xr-x | activerecord/test/base_test.rb | 4 |
3 files changed, 4 insertions, 9 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 72c599fb83..8aa0171b43 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -12,8 +12,6 @@ * Added counter optimization for AssociationCollection#any? so person.friends.any? won't actually load the full association if we have the count in a cheaper form [DHH] -* Subclasses of an abstract class work with single-table inheritance. #5704 [nick+rails@ag.arizona.edu, Ryan Davis, Jeremy Kemper] - * Change fixture_path to a class inheritable accessor allowing test cases to have their own custom set of fixtures. #6672 [zdennis] * Quote ActiveSupport::Multibyte::Chars. #6653 [Julian Tarkhanov] diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index b0ff70e5af..4c51d3f3ee 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -816,7 +816,7 @@ module ActiveRecord #:nodoc: end def descends_from_active_record? # :nodoc: - superclass.abstract_class? || !columns_hash.include?(inheritance_column) + superclass == Base || !columns_hash.include?(inheritance_column) end @@ -1360,7 +1360,7 @@ module ActiveRecord #:nodoc: # Returns the class descending directly from ActiveRecord in the inheritance hierarchy. def class_of_active_record_descendant(klass) - if klass.superclass.abstract_class? + if klass.superclass == Base || klass.superclass.abstract_class? klass elsif klass.superclass.nil? raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord" @@ -1481,9 +1481,6 @@ module ActiveRecord #:nodoc: end end - # ActiveRecord::Base is abstract. - self.abstract_class = true - public # New objects can be instantiated as either empty (pass no construction parameter) or pre-set with # attributes but not yet saved (pass a hash with key names matching the associated table column names). diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 3eb5a676a4..bd9666bc79 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -1365,7 +1365,7 @@ class BasicsTest < Test::Unit::TestCase end def test_abstract_class - assert ActiveRecord::Base.abstract_class? + assert !ActiveRecord::Base.abstract_class? assert LoosePerson.abstract_class? assert !LooseDescendant.abstract_class? end @@ -1408,7 +1408,7 @@ class BasicsTest < Test::Unit::TestCase assert !StiPost.descends_from_active_record? # Concrete subclasses an abstract class which has a type column. - assert SubStiPost.descends_from_active_record? + assert !SubStiPost.descends_from_active_record? end def test_find_on_abstract_base_class_doesnt_use_type_condition |