method

within_new_transaction

Importance_0
v6.0.0 - Show latest stable - 0 notes - Class: TransactionManager
within_new_transaction(options = {}) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 277
      def within_new_transaction(options = {})
        @connection.lock.synchronize do
          transaction = begin_transaction options
          yield
        rescue Exception => error
          if transaction
            rollback_transaction
            after_failure_actions(transaction, error)
          end
          raise
        ensure
          if !error && transaction
            if Thread.current.status == "aborting"
              rollback_transaction
            else
              begin
                commit_transaction
              rescue Exception
                rollback_transaction(transaction) unless transaction.state.completed?
                raise
              end
            end
          end
        end
      end
Register or log in to add new notes.