Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
quentindemetz committed Feb 6, 2024
1 parent e282754 commit a491ce4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/after_commit_everywhere.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ def register_callback(prepend:, connection: nil, name:, without_tx:, callback:)

connection ||= default_connection
wrap = Wrap.new(connection: connection, "#{name}": callback)
connection.add_transaction_record(wrap)

if prepend
records = connection.current_transaction.instance_variable_get(:@records)
records.unshift(records.pop)
connection.current_transaction.instance_variable_get(:@records).unshift(wrap)
else
connection.add_transaction_record(wrap)
end
end

Expand Down

0 comments on commit a491ce4

Please sign in to comment.