aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_one_association.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-18 11:07:03 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-18 11:07:03 +0000
commitbce0e1493024ccfe78efc93da14740a8d503cb7c (patch)
treef6619f94f9cfa1742eeb0f2acada7b68be27b523 /activerecord/lib/active_record/associations/has_one_association.rb
parent652f1ef02fdf75e8e971971707b3d5861d06b8be (diff)
downloadrails-bce0e1493024ccfe78efc93da14740a8d503cb7c.tar.gz
rails-bce0e1493024ccfe78efc93da14740a8d503cb7c.tar.bz2
rails-bce0e1493024ccfe78efc93da14740a8d503cb7c.zip
Fixed that the belongs_to and has_one proxy would fail a test like 'if project.manager' -- this unfortunately also means that you can't call methods like project.manager.build unless there already is a manager on the project #492 [Tim Bates]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@456 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_one_association.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb
index 74e82f146a..30704b6f7e 100644
--- a/activerecord/lib/active_record/associations/has_one_association.rb
+++ b/activerecord/lib/active_record/associations/has_one_association.rb
@@ -25,9 +25,9 @@ module ActiveRecord
@loaded = true
unless @owner.new_record? or obj.nil? or dont_save
- return (obj.save ? obj : false)
+ return (obj.save ? self : false)
else
- return obj
+ return (obj.nil? ? nil : self)
end
end