274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
# File 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb', line 274
def before_commit_records
if @run_commit_callbacks
if records
if ActiveRecord.before_committed_on_all_records
ite = unique_records
instances_to_run_callbacks_on = records.each_with_object({}) do |record, candidates|
candidates[record] = record
end
run_action_on_records(ite, instances_to_run_callbacks_on) do |record, should_run_callbacks|
record.before_committed! if should_run_callbacks
end
else
records.uniq.each(&:before_committed!)
end
end
@callbacks&.each(&:before_commit)
end
end
|