Skip to content

Commit 9ea0a76

Browse files
authored
Merge pull request rails#54024 from zzak/transaction-class-method-doc
Fix transactions example to use `transaction` call on a model [ci skip]
2 parents 93de878 + f4f890e commit 9ea0a76

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

activerecord/lib/active_record/transactions.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,11 @@ module Transactions
219219
# database error will occur because the savepoint has already been
220220
# automatically released. The following example demonstrates the problem:
221221
#
222-
# Model.lease_connection.transaction do # BEGIN
223-
# Model.lease_connection.transaction(requires_new: true) do # CREATE SAVEPOINT active_record_1
224-
# Model.lease_connection.create_table(...) # active_record_1 now automatically released
225-
# end # RELEASE SAVEPOINT active_record_1
226-
# # ^^^^ BOOM! database error!
227-
# end
222+
# Model.transaction do # BEGIN
223+
# Model.transaction(requires_new: true) do # CREATE SAVEPOINT active_record_1
224+
# Model.lease_connection.create_table(...) # active_record_1 now automatically released
225+
# end # RELEASE SAVEPOINT active_record_1
226+
# end # ^^^^ BOOM! database error!
228227
#
229228
# Note that "TRUNCATE" is also a MySQL DDL statement!
230229
module ClassMethods

0 commit comments

Comments
 (0)