method

after_commit

rails latest stable - Class: ActiveRecord::Transaction

Method not available on this version

This method is only available on newer versions. The first available version (v7.2.3) is shown here.

after_commit(&block)
public

Registers a block to be called after the transaction is fully committed.

If there is no currently open transactions, the block is called immediately, unless the transaction is finalized, in which case attempting to register the callback raises ActiveRecord::ActiveRecordError.

If the transaction has a parent transaction, the callback is transferred to the parent when the current transaction commits, or dropped when the current transaction is rolled back. This operation is repeated until the outermost transaction is reached.

If the callback raises an error, the transaction remains committed.