From 7d1782a2c15094224986e60eb15e864f8ea18e37 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Wed, 8 Jun 2011 00:32:40 +0100 Subject: Allow polymorphic has_one to work when the association is set before the owner has been saved. Fixes #1524. --- activerecord/lib/active_record/associations/association.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 0ccf74c7a4..c3aee90124 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -177,9 +177,7 @@ module ActiveRecord # Sets the owner attributes on the given record def set_owner_attributes(record) - if owner.persisted? - creation_attributes.each { |key, value| record[key] = value } - end + creation_attributes.each { |key, value| record[key] = value } end # Should be true if there is a foreign key present on the owner which -- cgit v1.2.3