method

within_new_transaction

Importance_0
v5.0.0.1 - 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 187
      def within_new_transaction(options = {})
        transaction = begin_transaction options
        yield
      rescue Exception => error
        if transaction
          rollback_transaction
          after_failure_actions(transaction, error)
        end
        raise
      ensure
        unless error
          if Thread.current.status == 'aborting'
            rollback_transaction if transaction
          else
            begin
              commit_transaction
            rescue Exception
              rollback_transaction(transaction) unless transaction.state.completed?
              raise
            end
          end
        end
      end
Register or log in to add new notes.