demarches-normaliennes/app/models/champs/annuaire_education_champ.rb
2024-07-05 09:36:33 +02:00

17 lines
333 B
Ruby

class Champs::AnnuaireEducationChamp < Champs::TextChamp
def fetch_external_data?
true
end
def fetch_external_data
APIEducation::AnnuaireEducationAdapter.new(external_id).to_params
end
def selected_items
if external_id.present?
[{ value: external_id, label: value }]
else
[]
end
end
end