diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-07-31 16:31:33 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-07-31 16:31:33 -0400 |
commit | 057c23715434adcab9b12f987d615979d1f57549 (patch) | |
tree | 1333fa5048656a9993f337fb2c781d727670ee8b /activerecord/lib | |
parent | 62c75f4eacf6466a3bd1b22f97cda7ab7b597064 (diff) | |
download | rails-057c23715434adcab9b12f987d615979d1f57549.tar.gz rails-057c23715434adcab9b12f987d615979d1f57549.tar.bz2 rails-057c23715434adcab9b12f987d615979d1f57549.zip |
Replace ClosedTransaction with NullTransaction
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb | 11 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index e6a53b2122..46aaaae2ec 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -43,8 +43,8 @@ module ActiveRecord end end - class ClosedTransaction < Transaction #:nodoc: - def initialize; super(nil); end + class NullTransaction < Transaction #:nodoc: + def initialize; end def closed?; true; end def open?; false; end def joinable?; false; end @@ -203,14 +203,11 @@ module ActiveRecord end def current_transaction - @stack.last || closed_transaction + @stack.last || NULL_TRANSACTION end private - - def closed_transaction - @closed_transaction ||= ClosedTransaction.new - end + NULL_TRANSACTION = NullTransaction.new end end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 99c728814a..a1b6671664 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -46,7 +46,7 @@ module ActiveRecord autoload_at 'active_record/connection_adapters/abstract/transaction' do autoload :TransactionManager - autoload :ClosedTransaction + autoload :NullTransaction autoload :RealTransaction autoload :SavepointTransaction autoload :TransactionState |