aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_callbacks.md
diff options
context:
space:
mode:
authorvishalzambre <v.zambre@gmail.com>2017-04-06 13:02:52 +0530
committervishalzambre <v.zambre@gmail.com>2017-04-10 11:27:01 +0530
commita1d16751064afdf9f66756e3b87c6c59246907bf (patch)
tree06b233ba16cd054b9f616abaf1510886df3c8d0a /guides/source/active_record_callbacks.md
parentfd097cff79c62fedabffae4e9f0fb53c2ec8bcbe (diff)
downloadrails-a1d16751064afdf9f66756e3b87c6c59246907bf.tar.gz
rails-a1d16751064afdf9f66756e3b87c6c59246907bf.tar.bz2
rails-a1d16751064afdf9f66756e3b87c6c59246907bf.zip
[ci skip] documented issue related before_destroy
Updated text
Diffstat (limited to 'guides/source/active_record_callbacks.md')
-rw-r--r--guides/source/active_record_callbacks.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index 77bd3c97e8..817c7cc835 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -117,6 +117,8 @@ Here is a list with all the available Active Record callbacks, listed in the sam
WARNING. `after_save` runs both on create and update, but always _after_ the more specific callbacks `after_create` and `after_update`, no matter the order in which the macro calls were executed.
+NOTE: `before_destroy` callback should be placed before `dependent: :destroy` associations (or use the `prepend: true` option), to ensure they execute before the records are deleted by `dependent: :destroy`.
+
### `after_initialize` and `after_find`
The `after_initialize` callback will be called whenever an Active Record object is instantiated, either by directly using `new` or when a record is loaded from the database. It can be useful to avoid the need to directly override your Active Record `initialize` method.