diff options
author | Emanuel Evans <mail@emanuel.industries> | 2015-12-28 14:28:19 -0800 |
---|---|---|
committer | Emanuel Evans <mail@emanuel.industries> | 2015-12-28 14:28:19 -0800 |
commit | 95254e4f129cedd4048c63e2f068227d5f80864d (patch) | |
tree | 9b674b47c06fdc7275886c522cb3d419a01a1b06 /activerecord | |
parent | 0d2675f84f54504e5ba25b2f53b00bac239ef393 (diff) | |
download | rails-95254e4f129cedd4048c63e2f068227d5f80864d.tar.gz rails-95254e4f129cedd4048c63e2f068227d5f80864d.tar.bz2 rails-95254e4f129cedd4048c63e2f068227d5f80864d.zip |
Allow add_to_transaction with null transaction
Fixes https://github.com/rails/rails/issues/22819
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 5 |
2 files changed, 6 insertions, 0 deletions
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 |