demarches-normaliennes/app/models/champs/checkbox_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

19 lines
273 B
Ruby

class Champs::CheckboxChamp < Champ
def search_terms
if value == 'on'
[libelle]
end
end
def to_s
value == 'on' ? 'Oui' : 'Non'
end
def for_export
value == 'on' ? 'on' : 'off'
end
def for_api
value == 'on' ? 'on' : 'off'
end
end