Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 5753

Show
Ignore:
Timestamp:
12/19/06 19:47:21 (2 years ago)
Author:
bitsweat
Message:

Partially revert [5660] - makes more trouble than it resolves. References #5704, closes #6766.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r5751 r5753  
    1212 
    1313* 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] 
    1614 
    1715* 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  
    817817 
    818818      def descends_from_active_record? # :nodoc: 
    819         superclass.abstract_class? || !columns_hash.include?(inheritance_column) 
     819        superclass == Base || !columns_hash.include?(inheritance_column) 
    820820      end 
    821821 
     
    13611361        # Returns the class descending directly from ActiveRecord in the inheritance hierarchy. 
    13621362        def class_of_active_record_descendant(klass) 
    1363           if klass.superclass.abstract_class? 
     1363          if klass.superclass == Base || klass.superclass.abstract_class? 
    13641364            klass 
    13651365          elsif klass.superclass.nil? 
     
    14811481        end 
    14821482    end 
    1483  
    1484     # ActiveRecord::Base is abstract. 
    1485     self.abstract_class = true 
    14861483 
    14871484    public 
  • trunk/activerecord/test/base_test.rb

    r5660 r5753  
    13661366 
    13671367  def test_abstract_class 
    1368     assert ActiveRecord::Base.abstract_class? 
     1368    assert !ActiveRecord::Base.abstract_class? 
    13691369    assert LoosePerson.abstract_class? 
    13701370    assert !LooseDescendant.abstract_class? 
     
    14091409 
    14101410    # Concrete subclasses an abstract class which has a type column. 
    1411     assert SubStiPost.descends_from_active_record? 
     1411    assert !SubStiPost.descends_from_active_record? 
    14121412  end 
    14131413