Skip to content

Commit

Permalink
Merge [5753] from trunk.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5754 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Dec 19, 2006
1 parent c3c7648 commit 498bca8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 0 additions & 2 deletions activerecord/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

* find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using. #6764 [vitaly, Jeremy Kemper]

* Subclasses of an abstract class work with single-table inheritance. #5704 [nick+rails@ag.arizona.edu, Ryan Davis, Jeremy Kemper]

* Support nil and Array in :conditions => { attr => value } hashes. #6548 [Assaf, Jeremy Kemper]
find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }

Expand Down
7 changes: 2 additions & 5 deletions activerecord/lib/active_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ def human_attribute_name(attribute_key_name) #:nodoc:
end

def descends_from_active_record? # :nodoc:
superclass.abstract_class? || !columns_hash.include?(inheritance_column)
superclass == Base || !columns_hash.include?(inheritance_column)
end


Expand Down Expand Up @@ -1360,7 +1360,7 @@ def compute_type(type_name)

# 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"
Expand Down Expand Up @@ -1481,9 +1481,6 @@ def encode_quoted_value(value) #: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).
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ def test_scoped_find_order_including_has_many_association
end

def test_abstract_class
assert ActiveRecord::Base.abstract_class?
assert !ActiveRecord::Base.abstract_class?
assert LoosePerson.abstract_class?
assert !LooseDescendant.abstract_class?
end
Expand Down Expand Up @@ -1379,7 +1379,7 @@ def test_descends_from_active_record
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
Expand Down

0 comments on commit 498bca8

Please sign in to comment.