From 9dbde4f5cbd0617ee6cce3e41d41335f9c9ce3fd Mon Sep 17 00:00:00 2001 From: pivotal Date: Tue, 26 Aug 2008 09:20:24 -0700 Subject: Fix two has_one :through errors * Set the association target on assignment; * Reset target to nil on reset, rather than empty array. Signed-off-by: Michael Koziarski [#895 state:committed] --- .../lib/active_record/associations/has_one_through_association.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/has_one_through_association.rb b/activerecord/lib/active_record/associations/has_one_through_association.rb index c846956e1f..b78bd5d931 100644 --- a/activerecord/lib/active_record/associations/has_one_through_association.rb +++ b/activerecord/lib/active_record/associations/has_one_through_association.rb @@ -22,6 +22,10 @@ module ActiveRecord def find_target super.first + end + + def reset_target! + @target = nil end end end -- cgit v1.2.3