aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRobert Whitney <robertj.whitney@gmail.com>2013-03-09 12:34:32 -0500
committerRobert Whitney <robertj.whitney@gmail.com>2013-03-09 13:10:56 -0500
commit3dffa0d2331a5e25bac2b046f81baac7f0535d68 (patch)
tree2097cee06b2ce4006b844b2a03f927686d9ffe5f /activerecord/lib
parent0b93c259fa945c088bc9c6f64621c9976e58bf75 (diff)
downloadrails-3dffa0d2331a5e25bac2b046f81baac7f0535d68.tar.gz
rails-3dffa0d2331a5e25bac2b046f81baac7f0535d68.tar.bz2
rails-3dffa0d2331a5e25bac2b046f81baac7f0535d68.zip
Update documentation for collection<< to reflect << on new records.
collection<< does not automatically fire update sql unless the parent object is not a new record (and thus has a primary key). eg: p = Post.new p.comments << Comment.new does not call update sql until: p.save at which point it saves the parent object and then the collection object. changes that to the
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 35e4eb19a4..7e99380a29 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1024,7 +1024,7 @@ module ActiveRecord
# [collection<<(object, ...)]
# Adds one or more objects to the collection by setting their foreign keys to the collection's primary key.
# Note that this operation instantly fires update sql without waiting for the save or update call on the
- # parent object.
+ # parent object, unless the parent object is a new record.
# [collection.delete(object, ...)]
# Removes one or more objects from the collection by setting their foreign keys to +NULL+.
# Objects will be in addition destroyed if they're associated with <tt>dependent: :destroy</tt>,
@@ -1433,7 +1433,7 @@ module ActiveRecord
# Adds one or more objects to the collection by creating associations in the join table
# (<tt>collection.push</tt> and <tt>collection.concat</tt> are aliases to this method).
# Note that this operation instantly fires update sql without waiting for the save or update call on the
- # parent object.
+ # parent object, unless the parent object is a new record.
# [collection.delete(object, ...)]
# Removes one or more objects from the collection by removing their associations from the join table.
# This does not destroy the objects.