Method: ActiveRecord::Transaction#after_rollback

Defined in:
activerecord/lib/active_record/transaction.rb

#after_rollback(&block) ⇒ Object

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.



107
108
109
# File 'activerecord/lib/active_record/transaction.rb', line 107

def after_rollback(&block)
  @internal_transaction&.after_rollback(&block)
end