From 79cbfc8290f08212faecdb32cea585c435091e87 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 21 Sep 2012 12:58:14 +0300 Subject: Add extra note about :dependent => :destroy. Callbacks may interfere with each other. --- activerecord/lib/active_record/associations.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 577b87e708..d8ab039cec 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1100,7 +1100,10 @@ module ActiveRecord # Specify the method that returns the primary key used for the association. By default this is +id+. # [:dependent] # Controls what happens to the associated objects when - # their owner is destroyed: + # their owner is destroyed. Note that these are implemented as + # callbacks, and Rails executes callbacks in order. Therefore, other + # similar callbacks may affect the :dependent behavior, and the + # :dependent behavior may affect other callbacks. # # * :destroy causes all the associated objects to also be destroyed # * :delete_all causes all the asssociated objects to be deleted directly from the database (so callbacks will not execute) -- cgit v1.2.3