Sha256: c50dc51faf50aacfa4d5e25f0e4f54b481bbdd456f0c36e7b5531064ce4fc6ea
Contents?: true
Size: 735 Bytes
Versions: 84
Compression:
Stored size: 735 Bytes
Contents
# frozen_string_literal: true module Plutonium module Lib class AfterCommit def initialize(rolled_back: false, &block) @rolled_back = rolled_back @callback = block end def committed!(*) @callback.call end def before_committed!(*) end def rolledback!(*) @callback.call if @rolled_back end def trigger_transactional_callbacks? true end class << self def execute(rolled_back: false, connection: ActiveRecord::Base.connection, &) connection.transaction_open? ? connection.add_transaction_record(AfterCommit.new(rolled_back: rolled_back, &)) : yield nil end end end end end
Version data entries
84 entries across 84 versions & 1 rubygems