From 47ff3086afd7d59daa05f72ab50b74c7bad5e369 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 31 Jan 2024 16:38:58 +0100 Subject: [PATCH] fix(rebase): preload revision too --- app/models/concerns/dossier_rebase_concern.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/dossier_rebase_concern.rb b/app/models/concerns/dossier_rebase_concern.rb index e8de8e68a..4efc58181 100644 --- a/app/models/concerns/dossier_rebase_concern.rb +++ b/app/models/concerns/dossier_rebase_concern.rb @@ -2,6 +2,7 @@ module DossierRebaseConcern extend ActiveSupport::Concern def rebase!(force: false) + ProcedureRevisionPreloader.new([procedure.published_revision, revision].compact).all return if procedure.published_revision.blank? if force || can_rebase? @@ -57,7 +58,7 @@ module DossierRebaseConcern .tap { _1.default = [] } champs_by_stable_id = champs - .includes(:type_de_champ) + .joins(:type_de_champ) .group_by(&:stable_id) .transform_values { Champ.where(id: _1) } .tap { _1.default = Champ.none }