Zum Inhalt springen

Missing Bulk Operation (ARCH6053)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key ruby.orm.missing-bulk-operation · Severity warning · Category orm

Issuing single-row inserts/updates in a loop while a bulk API like insert_all/upsert_all exists produces needless round-trips. The work should collapse into one bulk call.

products.each do |p|
Item.create!(sku: p[:sku], price: p[:price])
end
rows = products.map { |p| { sku: p[:sku], price: p[:price] } }
Item.insert_all(rows)

Convert the per-row writes in the loop into a single bulk call such as insert_all/upsert_all.