From 06afb8c7465e6b01833edfbae70547cf03c06480 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 23 Jan 2007 04:19:16 +0000 Subject: Subclasses of an abstract class work with single-table inheritance. References #5704, closes #7284. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6013 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index a783feafed..b8a497ffa3 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -817,8 +817,13 @@ module ActiveRecord #:nodoc: attribute_key_name.humanize end - def descends_from_active_record? # :nodoc: - superclass == Base || !columns_hash.include?(inheritance_column) + # True if this isn't a concrete subclass needing a STI type condition. + def descends_from_active_record? + if superclass.abstract_class? + superclass.descends_from_active_record? + else + superclass == Base || !columns_hash.include?(inheritance_column) + end end -- cgit v1.2.3