aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2014-07-30 14:32:56 -0400
committerArthur Neves <arthurnn@gmail.com>2014-07-31 15:48:03 -0400
commit4140797967a8f50eccaa70614c01531dab6a90f4 (patch)
tree142f1c7097cb94e127e4efe9f8c7f92f2fd08429 /activerecord
parentdac9c92e3096ae196d7ea4b58e7141f4a36007ea (diff)
downloadrails-4140797967a8f50eccaa70614c01531dab6a90f4.tar.gz
rails-4140797967a8f50eccaa70614c01531dab6a90f4.tar.bz2
rails-4140797967a8f50eccaa70614c01531dab6a90f4.zip
Make ClosedTransaction a null object
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/transaction.rb22
1 files changed, 6 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
index 17d57a7519..ff7f922d7f 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
@@ -50,7 +50,7 @@ module ActiveRecord
private
def closed_transaction
- @closed_transaction ||= ClosedTransaction.new(@connection)
+ @closed_transaction ||= ClosedTransaction.new
end
end
@@ -98,21 +98,12 @@ module ActiveRecord
end
class ClosedTransaction < Transaction #:nodoc:
- def closed?
- true
- end
-
- def open?
- false
- end
-
- def joinable?
- false
- end
-
+ def initialize; super(nil); end
+ def closed?; true; end
+ def open?; false; end
+ def joinable?; false; end
# This is a noop when there are no open transactions
- def add_record(record)
- end
+ def add_record(record); end
end
class OpenTransaction < Transaction #:nodoc:
@@ -126,7 +117,6 @@ module ActiveRecord
@joinable = options.fetch(:joinable, true)
end
-
def joinable?
@joinable
end