From ab157ac6bef3e1aa9c3a221011c5dd7024f14d7e Mon Sep 17 00:00:00 2001 From: Nate Berkopec Date: Mon, 1 Apr 2013 19:19:11 -0400 Subject: Fix #new with an STI object with complex inheritance --- activerecord/lib/active_record/inheritance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/inheritance.rb') diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index f54865c86e..8df76c7f5f 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -174,7 +174,7 @@ module ActiveRecord if subclass_name.present? && subclass_name != self.name subclass = subclass_name.safe_constantize - unless subclasses.include?(subclass) + unless descendants.include?(subclass) raise ActiveRecord::SubclassNotFound.new("Invalid single-table inheritance type: #{subclass_name} is not a subclass of #{name}") end -- cgit v1.2.3