Permalink
Browse files

Improve documentation for assocations :autosave option.

  • Loading branch information...
1 parent 36d1e90 commit 9dda440c38bd9878b0aa7ceb854bf4f1beeabd68 @ebeigarts ebeigarts committed Jun 22, 2010
Showing with 12 additions and 4 deletions.
  1. +12 −4 activerecord/lib/active_record/associations.rb
@@ -886,7 +886,9 @@ module ClassMethods
# [:validate]
# If false, don't validate the associated objects when saving the parent object. true by default.
# [:autosave]
- # If true, always save any loaded members and destroy members marked for destruction, when saving the parent object. Off by default.
+ # If true, always save the associated objects or destroy them if marked for destruction, when saving the parent object.
+ # If false, never save or destroy the associated objects.
+ # By default, only save associated objects that are new records.
# [:inverse_of]
# Specifies the name of the <tt>belongs_to</tt> association on the associated object that is the inverse of this <tt>has_many</tt>
# association. Does not work in combination with <tt>:through</tt> or <tt>:as</tt> options.
@@ -1001,7 +1003,9 @@ def has_many(association_id, options = {}, &extension)
# [:validate]
# If false, don't validate the associated object when saving the parent object. +false+ by default.
# [:autosave]
- # If true, always save the associated object or destroy it if marked for destruction, when saving the parent object. Off by default.
+ # If true, always save the associated object or destroy it if marked for destruction, when saving the parent object.
+ # If false, never save or destroy the associated object.
+ # By default, only save the associated object if it's a new record.
# [:inverse_of]
# Specifies the name of the <tt>belongs_to</tt> association on the associated object that is the inverse of this <tt>has_one</tt>
# association. Does not work in combination with <tt>:through</tt> or <tt>:as</tt> options.
@@ -1103,7 +1107,9 @@ def has_one(association_id, options = {})
# [:validate]
# If false, don't validate the associated objects when saving the parent object. +false+ by default.
# [:autosave]
- # If true, always save the associated object or destroy it if marked for destruction, when saving the parent object. Off by default.
+ # If true, always save the associated object or destroy it if marked for destruction, when saving the parent object.
+ # If false, never save or destroy the associated object.
+ # By default, only save the associated object if it's a new record.
# [:touch]
# If true, the associated object will be touched (the updated_at/on attributes set to now) when this record is either saved or
# destroyed. If you specify a symbol, that attribute will be updated with the current time instead of the updated_at/on attribute.
@@ -1290,7 +1296,9 @@ def belongs_to(association_id, options = {})
# [:validate]
# If false, don't validate the associated objects when saving the parent object. +true+ by default.
# [:autosave]
- # If true, always save any loaded members and destroy members marked for destruction, when saving the parent object. Off by default.
+ # If true, always save the associated objects or destroy them if marked for destruction, when saving the parent object.
+ # If false, never save or destroy the associated objects.
+ # By default, only save associated objects that are new records.
#
# Option examples:
# has_and_belongs_to_many :projects

0 comments on commit 9dda440

Please sign in to comment.