From 1c614bcb0fb65f0a5541263deacda498e52f447b Mon Sep 17 00:00:00 2001 From: thedarkone Date: Sat, 21 May 2011 15:18:09 +0200 Subject: Handle polymorphic_type NOT NULL-able columns as well. --- .../active_record/associations/belongs_to_polymorphic_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb index 1ca448236e..198ad06360 100644 --- a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb @@ -19,7 +19,7 @@ module ActiveRecord def klass type = owner[reflection.foreign_type] - type && type.constantize + type.presence && type.constantize end def raise_on_type_mismatch(record) -- cgit v1.2.3