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

19 lines
364 B
Ruby

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