method

after_rollback

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_rollback(&block)
public

Registers a block to be called after the transaction is rolled back.

If there is no currently open transactions, the block is not called. But if the transaction is finalized, attempting to register the callback raises ActiveRecord::ActiveRecordError.

If the transaction is successfully committed but has a parent transaction, the callback is automatically added to the parent transaction.

If the entire chain of nested transactions are all successfully committed, the block is never called.

If the transaction is already finalized, attempting to register a callback will raise ActiveRecord::ActiveRecordError.