aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRobbert Brak <robbert.brak@4me.com>2018-09-14 08:48:26 +0200
committerRobbert Brak <robbert.brak@4me.com>2018-09-14 08:48:26 +0200
commit0a6579277038ef4442207b1134d7932ff00c9a4c (patch)
tree504dd81dc076c03b9769d386fd4bf934197b4f55 /guides
parentd2812d9a9e05a72374b9f7b32bab508b087f12b7 (diff)
downloadrails-0a6579277038ef4442207b1134d7932ff00c9a4c.tar.gz
rails-0a6579277038ef4442207b1134d7932ff00c9a4c.tar.bz2
rails-0a6579277038ef4442207b1134d7932ff00c9a4c.zip
Clarify transactional behavior of after_commit and after_rollback callbacks
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_record_callbacks.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index 5946acb412..ebdee446f9 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -435,7 +435,9 @@ class PictureFile < ApplicationRecord
end
```
-WARNING. The `after_commit` and `after_rollback` callbacks are called for all models created, updated, or destroyed within a transaction block. However, if an exception is raised within one of these callbacks, the exception will bubble up and any remaining `after_commit` or `after_rollback` methods will _not_ be executed. As such, if your callback code could raise an exception, you'll need to rescue it and handle it within the callback in order to allow other callbacks to run.
+WARNING. When a transaction completes, the `after_commit` or `after_rollback` callbacks are called for all models created, updated, or destroyed within that transaction. However, if an exception is raised within one of these callbacks, the exception will bubble up and any remaining `after_commit` or `after_rollback` methods will _not_ be executed. As such, if your callback code could raise an exception, you'll need to rescue it and handle it within the callback in order to allow other callbacks to run.
+
+WARNING. The code executed within `after_commit` or `after_rollback` callbacks is itself not enclosed within a transaction.
WARNING. Using both `after_create_commit` and `after_update_commit` in the same model will only allow the last callback defined to take effect, and will override all others.