aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r--activerecord/lib/active_record/associations.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 60b7118d7e..258d602afa 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -950,6 +950,11 @@ module ActiveRecord
# specific association types. When no option is given, the behaviour is to do nothing
# with the associated records when destroying a record.
#
+ # Note that <tt>:dependent</tt> is implemented using Rails' callback
+ # system, which works by processing callbacks in order. Therefore, other
+ # callbacks declared either before or after the <tt>:dependent</tt> option
+ # can affect what it does.
+ #
# === Delete or destroy?
#
# +has_many+ and +has_and_belongs_to_many+ associations have the methods <tt>destroy</tt>,
@@ -1095,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.
#
# * <tt>:destroy</tt> causes all the associated objects to also be destroyed
# * <tt>:delete_all</tt> causes all the asssociated objects to be deleted directly from the database (so callbacks will not execute)