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

15 lines
451 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Champs::SiretController < Champs::ChampController
2018-09-06 19:23:27 +02:00
def show
champs_attributes = params.dig(:dossier, :champs_public_attributes) || params.dig(:dossier, :champs_private_attributes)
siret = champs_attributes.values.first[:value]
2023-01-14 10:13:26 +01:00
if @champ.fetch_etablissement!(siret, current_user)
2023-01-14 10:13:26 +01:00
@siret = @champ.etablissement.siret
else
@siret = @champ.etablissement_fetch_error_key
end
end
2018-04-03 17:53:14 +02:00
end