demarches-normaliennes/app/controllers/champs/siret_controller.rb
2024-08-22 09:26:48 +02:00

14 lines
451 B
Ruby

# frozen_string_literal: true
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