Skip to content

Commit f5cec76

Browse files
committed
Extract the transaction class to a local variable
1 parent 6501aeb commit f5cec76

File tree

1 file changed

+2
-6
lines changed
  • activerecord/lib/active_record/connection_adapters/abstract

1 file changed

+2
-6
lines changed

activerecord/lib/active_record/connection_adapters/abstract/transaction.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ def initialize(connection)
77
end
88

99
def begin_transaction(options = {})
10-
transaction =
11-
if @stack.empty?
12-
RealTransaction.new(@connection, current_transaction, options)
13-
else
14-
SavepointTransaction.new(@connection, current_transaction, options)
15-
end
10+
transaction_class = @stack.empty? ? RealTransaction : SavepointTransaction
11+
transaction = transaction_class.new(@connection, current_transaction, options)
1612

1713
@stack.push(transaction)
1814
transaction

0 commit comments

Comments
 (0)