Skip to content

Commit be0ab85

Browse files
committed
Fix the method signature for transaction helper in CollectionAssociation
The arguments for `transaction` should be `**options`, actually `*args` is unused though. And also, the comment is not for the method anymore, the method is not called from public.
1 parent c02d9e5 commit be0ab85

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

activerecord/lib/active_record/associations/collection_association.rb

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,6 @@ def concat(*records)
121121
end
122122
end
123123

124-
# Starts a transaction in the association class's database connection.
125-
#
126-
# class Author < ActiveRecord::Base
127-
# has_many :books
128-
# end
129-
#
130-
# Author.first.books.transaction do
131-
# # same effect as calling Book.transaction
132-
# end
133-
def transaction(*args)
134-
reflection.klass.transaction(*args) do
135-
yield
136-
end
137-
end
138-
139124
# Removes all records from the association without calling callbacks
140125
# on the associated records. It honors the +:dependent+ option. However
141126
# if the +:dependent+ value is +:destroy+ then in that case the +:delete_all+
@@ -315,6 +300,10 @@ def find_from_target?
315300
end
316301

317302
private
303+
def transaction(&block)
304+
reflection.klass.transaction(&block)
305+
end
306+
318307
# We have some records loaded from the database (persisted) and some that are
319308
# in-memory (memory). The same record may be represented in the persisted array
320309
# and in the memory array.

0 commit comments

Comments
 (0)