diff --git a/app/models/dossier_preloader.rb b/app/models/dossier_preloader.rb index c1f8d82fa..f1056a9ad 100644 --- a/app/models/dossier_preloader.rb +++ b/app/models/dossier_preloader.rb @@ -63,7 +63,8 @@ class DossierPreloader def load_etablissements(champs) to_include = @includes_for_etablissement.dup - champs_siret = champs.filter(&:siret?) + # `champs.siret?` will delegate to type_de_champ; this is not what we want here + champs_siret = champs.filter { _1.type == 'Champs::SiretChamp' } etablissements_by_id = Etablissement.includes(to_include).where(id: champs_siret.map(&:etablissement_id).compact).index_by(&:id) champs_siret.each do |champ| etablissement = etablissements_by_id[champ.etablissement_id]