Permalink
Browse files

Extract the transaction class to a local variable

  • Loading branch information...
1 parent 6501aeb commit f5cec76ea8de1b9d076d0b1138ab8c2cabc0390d @rafaelfranca rafaelfranca committed Jul 28, 2014
Showing with 2 additions and 6 deletions.
  1. +2 −6 activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
@@ -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

0 comments on commit f5cec76

Please sign in to comment.