From 115eedbb410c52364e3353266316c218a29e5998 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sun, 16 Jan 2011 19:42:34 +0000 Subject: Use self.target= rather than @target= as the former automatically sets loaded --- activerecord/lib/active_record/associations/belongs_to_association.rb | 4 +--- activerecord/lib/active_record/associations/has_one_association.rb | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index a818a780ed..11e16de738 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -10,11 +10,9 @@ module ActiveRecord replace_keys(record) set_inverse_instance(record) - @target = record @updated = true if record - loaded - record + self.target = record end def updated? diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index c38843ea68..1b366b74b6 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -24,8 +24,7 @@ module ActiveRecord end end - @target = record - loaded + self.target = record end private -- cgit v1.2.3