Skip to content

Commit

Permalink
Add docs about behaviour of replacing a has_one associate object, tha…
Browse files Browse the repository at this point in the history
…t the previous one is deleted even if the new one

 doesn't get persisted to database.

 Fixes #13197 . [ci skip]
  • Loading branch information
vipulnsward committed Jan 28, 2014
1 parent a31a44a commit f93ce1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion activerecord/lib/active_record/associations.rb
Expand Up @@ -1213,7 +1213,8 @@ def has_many(name, scope = nil, options = {}, &extension)
# 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
Expand Down

0 comments on commit f93ce1b

Please sign in to comment.