From 437b3d2a612f2ad811d6550fd070d534807b6161 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 31 Jan 2024 16:48:39 +0100 Subject: [PATCH] fix(perf): last n+1 --- app/models/concerns/dossier_rebase_concern.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/dossier_rebase_concern.rb b/app/models/concerns/dossier_rebase_concern.rb index 4efc58181..322809b52 100644 --- a/app/models/concerns/dossier_rebase_concern.rb +++ b/app/models/concerns/dossier_rebase_concern.rb @@ -58,7 +58,7 @@ module DossierRebaseConcern .tap { _1.default = [] } champs_by_stable_id = champs - .joins(:type_de_champ) + .includes(:type_de_champ) .group_by(&:stable_id) .transform_values { Champ.where(id: _1) } .tap { _1.default = Champ.none }