From e728a3fcb77ad6585d946c418fe4cbe079f4362c Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 16 Apr 2021 12:17:26 +0200 Subject: [PATCH] include type_de_champ Avoid n+1 when matching champ.stable_id in procedure.presentation.displayed_fields_values win 2s in the worst 3s scenario --- app/models/procedure_presentation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 297b2ffd4..0c46fb936 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -177,9 +177,9 @@ class ProcedurePresentation < ApplicationRecord .map do |table| case table when 'type_de_champ' - :champs + { champs: :type_de_champ } when 'type_de_champ_private' - :champs_private + { champs_private: :type_de_champ } else table end