From 99f3ae08450ecfd7574336837a75c7fd0dd17305 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 13 Oct 2005 19:21:45 +0000 Subject: Fix errors caused by assigning a has-one or belongs-to property to itself git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2562 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/belongs_to_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations/belongs_to_association.rb') diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 681bd1b88d..9dc0e26e10 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -30,7 +30,7 @@ module ActiveRecord else raise_on_type_mismatch(obj) unless obj.nil? - @target = obj + @target = (AssociationProxy === obj ? obj.target : obj) @owner[@association_class_primary_key_name] = obj.id unless obj.new_record? @updated = true end -- cgit v1.2.3