demarches-normaliennes/app/models/champs/yes_no_champ.rb
gregoirenovel 864bb38d8a Add #for_api methods to CheckboxChamp and YesNoChamp
Otherwise, we return nil instead of “off” / “non”,
so we don’t expose the data properly
2019-01-08 12:32:27 +01:00

25 lines
324 B
Ruby

class Champs::YesNoChamp < Champs::CheckboxChamp
def search_terms
if value == 'true'
[libelle]
end
end
def to_s
processed_value
end
def for_export
processed_value
end
def for_api
processed_value
end
private
def processed_value
value == 'true' ? 'Oui' : 'Non'
end
end