Skip to content
This repository
Browse code

Add extra note about :dependent => :destroy.

Callbacks may interfere with each other.
  • Loading branch information...
commit 79cbfc8290f08212faecdb32cea585c435091e87 1 parent 79942d4
Steve Klabnik authored September 21, 2012
5  activerecord/lib/active_record/associations.rb
@@ -1100,7 +1100,10 @@ module ClassMethods
1100 1100
       #   Specify the method that returns the primary key used for the association. By default this is +id+.
1101 1101
       # [:dependent]
1102 1102
       #   Controls what happens to the associated objects when
1103  
-      #   their owner is destroyed:
  1103
+      #   their owner is destroyed. Note that these are implemented as
  1104
+      #   callbacks, and Rails executes callbacks in order. Therefore, other
  1105
+      #   similar callbacks may affect the :dependent behavior, and the
  1106
+      #   :dependent behavior may affect other callbacks.
1104 1107
       #
1105 1108
       #   * <tt>:destroy</tt> causes all the associated objects to also be destroyed
1106 1109
       #   * <tt>:delete_all</tt> causes all the asssociated objects to be deleted directly from the database (so callbacks will not execute)

0 notes on commit 79cbfc8

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