Changeset 5753
- Timestamp:
- 12/19/06 19:47:21 (2 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/base.rb (modified) (3 diffs)
- trunk/activerecord/test/base_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r5751 r5753 12 12 13 13 * 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] 14 15 * Subclasses of an abstract class work with single-table inheritance. #5704 [nick+rails@ag.arizona.edu, Ryan Davis, Jeremy Kemper]16 14 17 15 * Change fixture_path to a class inheritable accessor allowing test cases to have their own custom set of fixtures. #6672 [zdennis] trunk/activerecord/lib/active_record/base.rb
r5751 r5753 817 817 818 818 def descends_from_active_record? # :nodoc: 819 superclass .abstract_class?|| !columns_hash.include?(inheritance_column)819 superclass == Base || !columns_hash.include?(inheritance_column) 820 820 end 821 821 … … 1361 1361 # Returns the class descending directly from ActiveRecord in the inheritance hierarchy. 1362 1362 def class_of_active_record_descendant(klass) 1363 if klass.superclass .abstract_class?1363 if klass.superclass == Base || klass.superclass.abstract_class? 1364 1364 klass 1365 1365 elsif klass.superclass.nil? … … 1481 1481 end 1482 1482 end 1483 1484 # ActiveRecord::Base is abstract.1485 self.abstract_class = true1486 1483 1487 1484 public trunk/activerecord/test/base_test.rb
r5660 r5753 1366 1366 1367 1367 def test_abstract_class 1368 assert ActiveRecord::Base.abstract_class?1368 assert !ActiveRecord::Base.abstract_class? 1369 1369 assert LoosePerson.abstract_class? 1370 1370 assert !LooseDescendant.abstract_class? … … 1409 1409 1410 1410 # Concrete subclasses an abstract class which has a type column. 1411 assert SubStiPost.descends_from_active_record?1411 assert !SubStiPost.descends_from_active_record? 1412 1412 end 1413 1413