transaction (ActiveRecord::Transactions::ClassMethods)

    # File lib/active_record/transactions.rb, line 75
          def transaction(&block)
            previous_handler = trap('TERM') { raise TransactionError, "Transaction aborted" }
            increment_open_transactions

            begin
              connection.transaction(Thread.current['start_db_transaction'], &block)
            ensure
              decrement_open_transactions
              trap('TERM', previous_handler)
            end
          end