Skip to content

Commit 95a6729

Browse files
authored
Merge pull request rails#51886 from zzak/revert-51184
Revert "Merge pull request rails#51184 from ConfusedVorlon/document_after_commit_deduplication"
2 parents cacb847 + d4150ab commit 95a6729

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

activerecord/lib/active_record/transactions.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,6 @@ module Transactions
188188
# #after_commit is a good spot to put in a hook to clearing a cache since clearing it from
189189
# within a transaction could trigger the cache to be regenerated before the database is updated.
190190
#
191-
# *Warning*: Callbacks are deduplicated according to the callback and method.
192-
# This means you cannot have multiple <tt>after_xxx_commit</tt> shortcuts calling the same method.
193-
#
194-
# after_create_commit :do_foo # This will NOT fire
195-
# after_save_commit :do_foo
196-
#
197-
# Instead, use after_commit directly
198-
#
199-
# after_commit :do_foo, on: [:create, :save]
200-
#
201191
# === Caveats
202192
#
203193
# If you're on MySQL, then do not use Data Definition Language (DDL) operations in nested
@@ -252,32 +242,24 @@ def after_commit(*args, &block)
252242
end
253243

254244
# Shortcut for <tt>after_commit :hook, on: [ :create, :update ]</tt>.
255-
#
256-
# *Warning*: only one <tt>after_xxx_commit</tt> shortcut can call any given method.
257245
def after_save_commit(*args, &block)
258246
set_options_for_callbacks!(args, on: [ :create, :update ], **prepend_option)
259247
set_callback(:commit, :after, *args, &block)
260248
end
261249

262250
# Shortcut for <tt>after_commit :hook, on: :create</tt>.
263-
#
264-
# *Warning*: only one <tt>after_xxx_commit</tt> shortcut can call any given method.
265251
def after_create_commit(*args, &block)
266252
set_options_for_callbacks!(args, on: :create, **prepend_option)
267253
set_callback(:commit, :after, *args, &block)
268254
end
269255

270256
# Shortcut for <tt>after_commit :hook, on: :update</tt>.
271-
#
272-
# *Warning*: only one <tt>after_xxx_commit</tt> shortcut can call any given method.
273257
def after_update_commit(*args, &block)
274258
set_options_for_callbacks!(args, on: :update, **prepend_option)
275259
set_callback(:commit, :after, *args, &block)
276260
end
277261

278262
# Shortcut for <tt>after_commit :hook, on: :destroy</tt>.
279-
#
280-
# *Warning*: only one <tt>after_xxx_commit</tt> shortcut can call any given method.
281263
def after_destroy_commit(*args, &block)
282264
set_options_for_callbacks!(args, on: :destroy, **prepend_option)
283265
set_callback(:commit, :after, *args, &block)

0 commit comments

Comments
 (0)