From 95254e4f129cedd4048c63e2f068227d5f80864d Mon Sep 17 00:00:00 2001 From: Emanuel Evans Date: Mon, 28 Dec 2015 14:28:19 -0800 Subject: Allow add_to_transaction with null transaction Fixes https://github.com/rails/rails/issues/22819 --- .../lib/active_record/connection_adapters/abstract/transaction.rb | 1 + activerecord/test/cases/transactions_test.rb | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 295a7bed87..14d04a6388 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -33,6 +33,7 @@ module ActiveRecord class NullTransaction #:nodoc: def initialize; end + def state; end def closed?; true; end def open?; false; end def joinable?; false; end diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index ec5bdfd725..791b895d02 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -58,6 +58,11 @@ class TransactionTest < ActiveRecord::TestCase end end + def test_add_to_null_transaction + topic = Topic.new + topic.add_to_transaction + end + def test_successful_with_return committed = false -- cgit v1.2.3