Skip to content

Commit 6c745b0

Browse files
committed
Remove deprecated #set_state from the transaction object
1 parent 5f3ed87 commit 6c745b0

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated `#set_state` from the transaction object.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `#supports_statement_cache?` from the database adapters.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/connection_adapters/abstract/transaction.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,6 @@ def completed?
4040
committed? || rolledback?
4141
end
4242

43-
def set_state(state)
44-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
45-
The set_state method is deprecated and will be removed in
46-
Rails 6.0. Please use rollback! or commit! to set transaction
47-
state directly.
48-
MSG
49-
case state
50-
when :rolledback
51-
rollback!
52-
when :committed
53-
commit!
54-
when nil
55-
nullify!
56-
else
57-
raise ArgumentError, "Invalid transaction state: #{state}"
58-
end
59-
end
60-
6143
def rollback!
6244
@children.each { |c| c.rollback! }
6345
@state = :rolledback

activerecord/test/cases/transactions_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -884,17 +884,6 @@ def test_transactions_state_from_commit
884884
assert_predicate transaction.state, :committed?
885885
end
886886

887-
def test_set_state_method_is_deprecated
888-
connection = Topic.connection
889-
transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction
890-
891-
transaction.commit
892-
893-
assert_deprecated do
894-
transaction.state.set_state(:rolledback)
895-
end
896-
end
897-
898887
def test_mark_transaction_state_as_committed
899888
connection = Topic.connection
900889
transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction

0 commit comments

Comments
 (0)