aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDamien Mathieu <42@dmathieu.com>2014-01-28 00:15:59 -0800
committerDamien Mathieu <42@dmathieu.com>2014-01-28 00:15:59 -0800
commite09c4028b3ad2ce5a0a9dca3b7eb62f49310e63c (patch)
treefa7b5a6a40142a842c29691179c05e6929b9fce8 /activerecord/lib/active_record
parent61bd71ef5ca3f13fde476b2db59980a01c8b3120 (diff)
parentf93ce1bee992485de1d93e755a4c738c66b3b678 (diff)
downloadrails-e09c4028b3ad2ce5a0a9dca3b7eb62f49310e63c.tar.gz
rails-e09c4028b3ad2ce5a0a9dca3b7eb62f49310e63c.tar.bz2
rails-e09c4028b3ad2ce5a0a9dca3b7eb62f49310e63c.zip
Merge pull request #13838 from vipulnsward/13197-fix-has-one-documentation
Add docs about behaviour of replacing a has_one associate object.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 714f623af3..f3f77e21c0 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1213,7 +1213,8 @@ module ActiveRecord
# Returns the associated object. +nil+ is returned if none is found.
# [association=(associate)]
# Assigns the associate object, extracts the primary key, sets it as the foreign key,
- # and saves the associate object.
+ # and saves the associate object. To avoid database inconsistencies, permanently deletes an existing
+ # associated object when assigning a new one, even if the new one isn't saved to database.
# [build_association(attributes = {})]
# Returns a new object of the associated type that has been instantiated
# with +attributes+ and linked to this object through a foreign key, but has not