ensure to_s is used on specialized champ

This commit is contained in:
simon lehericey 2021-05-18 11:34:05 +02:00
parent 45a4a3d2d0
commit a46000dc1f
2 changed files with 12 additions and 1 deletions

View file

@ -33,7 +33,7 @@ class DossierProjectionService
types_de_champ: { stable_id: fields.map { |f| f[COLUMN] } },
dossier_id: dossiers_ids
)
.select(:dossier_id, :value, :type_de_champ_id, :stable_id) # we cannot pluck :value, as we need the champ.to_s method
.select(:dossier_id, :value, :type_de_champ_id, :stable_id, :type) # we cannot pluck :value, as we need the champ.to_s method
.group_by(&:stable_id) # the champs are redispatched to their respective fields
.map do |stable_id, champs|
field = fields.find { |f| f[COLUMN] == stable_id.to_s }