aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJakub Kuźma <qoobaa@gmail.com>2011-11-28 19:27:58 +0100
committerPiotr Sarnacki <drogus@gmail.com>2011-11-28 19:37:00 +0100
commitd1afd987464717f8af1ab0e9a78af6f37b9ce425 (patch)
tree71a4760f5928d5864a3aa3f0b1c5d3d7a86ed71f /activerecord/lib
parentba0b3eee144000b48ec609b75c18d1cdf07a10f3 (diff)
downloadrails-d1afd987464717f8af1ab0e9a78af6f37b9ce425.tar.gz
rails-d1afd987464717f8af1ab0e9a78af6f37b9ce425.tar.bz2
rails-d1afd987464717f8af1ab0e9a78af6f37b9ce425.zip
added information about callbacks created by autosave association (#3639)
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/autosave_association.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index d709a77fb0..6d3f1839c5 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -21,6 +21,21 @@ module ActiveRecord
# Note that <tt>:autosave => false</tt> is not same as not declaring <tt>:autosave</tt>.
# When the <tt>:autosave</tt> option is not present new associations are saved.
#
+ # == Validation
+ #
+ # Children records are validated unless <tt>:validate</tt> is +false+.
+ #
+ # == Callbacks
+ #
+ # Association with autosave option defines several callbacks on your
+ # model (before_save, after_create, after_update). Please note that
+ # callbacks are executed in the order they were defined in
+ # model. You should avoid modyfing the association content, before
+ # autosave callbacks are executed. Placing your callbacks after
+ # associations is usually a good practice.
+ #
+ # == Examples
+ #
# === One-to-one Example
#
# class Post
@@ -109,10 +124,7 @@ module ActiveRecord
# Now it _is_ removed from the database:
#
# Comment.find_by_id(id).nil? # => true
- #
- # === Validation
- #
- # Children records are validated unless <tt>:validate</tt> is +false+.
+
module AutosaveAssociation
extend ActiveSupport::Concern