aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-09-28 14:39:41 +0900
committerGitHub <noreply@github.com>2018-09-28 14:39:41 +0900
commit71030c93116e39b3c4838a50bfe57d9715439926 (patch)
tree9a09c3cb35f82cd128644b3cf02b9df932fc0200 /guides
parentd32d5c681d9b68b178f419ff36660dc9a1aafa5e (diff)
parent0a6579277038ef4442207b1134d7932ff00c9a4c (diff)
downloadrails-71030c93116e39b3c4838a50bfe57d9715439926.tar.gz
rails-71030c93116e39b3c4838a50bfe57d9715439926.tar.bz2
rails-71030c93116e39b3c4838a50bfe57d9715439926.zip
Merge pull request #33880 from robbertbrak/master
Clarify transactional behavior of after_commit and after_rollback callbacks [ci skip]
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.