From 1caa76304b6eef3d637d861585bda72ed367567f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 26 Sep 2006 06:56:17 +0000 Subject: has_one associations with a nil target may be safely marshaled. Closes #6279. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5188 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/association_proxy.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index ac7188d712..4cdbc52ccf 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -125,6 +125,8 @@ module ActiveRecord end def load_target + return nil unless defined?(@loaded) + if !loaded? and (!@owner.new_record? || foreign_key_present) @target = find_target end -- cgit v1.2.3