module ActiveRecord

def self.all_open_transactions # :nodoc:

:nodoc:
def self.all_open_transactions # :nodoc:
  open_transactions = []
  Base.connection_handler.each_connection_pool do |pool|
    if active_connection = pool.active_connection
      current_transaction = active_connection.current_transaction
      if current_transaction.open? && current_transaction.joinable? && !current_transaction.state.invalidated?
        open_transactions << current_transaction
      end
    end
  end
  open_transactions
end