demarches-normaliennes/app/controllers/champs/siret_controller.rb

12 lines
420 B
Ruby

class Champs::SiretController < Champs::ChampController
def show
champs_attributes = params.dig(:dossier, :champs_public_attributes) || params.dig(:dossier, :champs_private_attributes)
siret = champs_attributes.values.first[:value]
if @champ.fetch_etablissement!(siret, current_user)
@siret = @champ.etablissement.siret
else
@siret = @champ.etablissement_fetch_error_key
end
end
end