Skip to content
This repository
Browse code

added information about callbacks created by autosave association (#3639

)
  • Loading branch information...
commit d1afd987464717f8af1ab0e9a78af6f37b9ce425 1 parent ba0b3ee
Kuba Kuźma authored November 28, 2011 drogus committed November 28, 2011
20  activerecord/lib/active_record/autosave_association.rb
@@ -21,6 +21,21 @@ module ActiveRecord
21 21
   # Note that <tt>:autosave => false</tt> is not same as not declaring <tt>:autosave</tt>.
22 22
   # When the <tt>:autosave</tt> option is not present new associations are saved.
23 23
   #
  24
+  # == Validation
  25
+  #
  26
+  # Children records are validated unless <tt>:validate</tt> is +false+.
  27
+  #
  28
+  # == Callbacks
  29
+  #
  30
+  # Association with autosave option defines several callbacks on your
  31
+  # model (before_save, after_create, after_update). Please note that
  32
+  # callbacks are executed in the order they were defined in
  33
+  # model. You should avoid modyfing the association content, before
  34
+  # autosave callbacks are executed. Placing your callbacks after
  35
+  # associations is usually a good practice.
  36
+  #
  37
+  # == Examples
  38
+  #
24 39
   # === One-to-one Example
25 40
   #
26 41
   #   class Post
@@ -109,10 +124,7 @@ module ActiveRecord
109 124
   # Now it _is_ removed from the database:
110 125
   #
111 126
   #   Comment.find_by_id(id).nil? # => true
112  
-  #
113  
-  # === Validation
114  
-  #
115  
-  # Children records are validated unless <tt>:validate</tt> is +false+.
  127
+
116 128
   module AutosaveAssociation
117 129
     extend ActiveSupport::Concern
118 130
 

0 notes on commit d1afd98

Please sign in to comment.
Something went wrong with that request. Please try again.