Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extract the transaction class to a local variable

  • Loading branch information...
commit f5cec76ea8de1b9d076d0b1138ab8c2cabc0390d 1 parent 6501aeb
Rafael Mendonça França rafaelfranca authored
8 activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
View
@@ -7,12 +7,8 @@ def initialize(connection)
end
def begin_transaction(options = {})
- transaction =
- if @stack.empty?
- RealTransaction.new(@connection, current_transaction, options)
- else
- SavepointTransaction.new(@connection, current_transaction, options)
- end
+ transaction_class = @stack.empty? ? RealTransaction : SavepointTransaction
+ transaction = transaction_class.new(@connection, current_transaction, options)
@stack.push(transaction)
transaction
Please sign in to comment.
Something went wrong with that request. Please try again.