diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_association.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 4dbc0f6441..d07323a869 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -42,8 +42,7 @@ module ActiveRecord @target = nil else raise_on_type_mismatch(obj) - - obj[@reflection.primary_key_name] = @owner.id unless @owner.new_record? + set_belongs_to_association_for(obj) @target = (AssociationProxy === obj ? obj.target : obj) end |