aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-26 06:56:17 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-26 06:56:17 +0000
commit1caa76304b6eef3d637d861585bda72ed367567f (patch)
tree59e6c69bc870012a6104670dd92abc0d2145425b /activerecord/lib
parente5a0a2732718bebf17e43bf817864561daeada3f (diff)
downloadrails-1caa76304b6eef3d637d861585bda72ed367567f.tar.gz
rails-1caa76304b6eef3d637d861585bda72ed367567f.tar.bz2
rails-1caa76304b6eef3d637d861585bda72ed367567f.zip
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb2
1 files changed, 2 insertions, 0 deletions
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