instance method
after_commit
Ruby on Rails 7.2.3
Since v3.0.20Signature
after_commit(*args, &block)
This callback is called after a record has been created, updated, or destroyed.
You can specify that the callback should only be fired by a certain action with the :on option:
after_commit :do_foo, on: :create after_commit :do_bar, on: :update after_commit :do_baz, on: :destroy after_commit :do_foo_bar, on: [:create, :update] after_commit :do_bar_baz, on: [:update, :destroy]
Parameters
-
argsrest -
blockblock
Source
# File activerecord/lib/active_record/transactions.rb, line 266
def after_commit(*args, &block)
set_options_for_callbacks!(args, prepend_option)
set_callback(:commit, :after, *args, &block)
end
Defined in activerecord/lib/active_record/transactions.rb line 266
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Transactions::ClassMethods