diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-28 15:04:31 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-28 15:04:31 -0300 |
commit | f5cec76ea8de1b9d076d0b1138ab8c2cabc0390d (patch) | |
tree | 4325632caf0686cf68cbd8f20a6eb221c9df8c01 /activerecord/lib | |
parent | 6501aeb286ee25d3993e39c5badb9879b544c6bb (diff) | |
download | rails-f5cec76ea8de1b9d076d0b1138ab8c2cabc0390d.tar.gz rails-f5cec76ea8de1b9d076d0b1138ab8c2cabc0390d.tar.bz2 rails-f5cec76ea8de1b9d076d0b1138ab8c2cabc0390d.zip |
Extract the transaction class to a local variable
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 54f873a2a2..3a266512a9 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -7,12 +7,8 @@ module ActiveRecord 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 |