2018-02-13 18:18:20 +01:00
|
|
|
class Champs::DossierLinkChamp < Champ
|
2024-04-01 07:36:14 +02:00
|
|
|
# TODO: if: -> { validate_champ_value? || validation_context == :prefill }
|
2023-02-22 15:56:31 +01:00
|
|
|
validate :value_integerable, if: -> { value.present? }, on: :prefill
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def value_integerable
|
|
|
|
Integer(value)
|
|
|
|
rescue ArgumentError
|
|
|
|
errors.add(:value, :not_integerable)
|
|
|
|
end
|
2018-02-13 18:18:20 +01:00
|
|
|
end
|