Performance: CRUD operations through models
MEDIUM IMPACT
This affects how quickly data changes reflect on the page and the server response time during create, read, update, and delete actions.
Model.where(id: records.map(&:id)).update_all(attribute: new_value)records.each do |record| record.update(attribute: new_value) end
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple individual updates in loop | Minimal DOM changes but delayed | 0 (server-side delay) | Low paint cost but delayed update | [X] Bad |
| Batch update_all query | Minimal DOM changes but faster | 0 (server-side delay) | Low paint cost with faster update | [OK] Good |