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

13 lines
270 B
Ruby

# frozen_string_literal: true
class Champs::DossierLinkChamp < Champ
validate :value_integerable, if: -> { value.present? }, on: :prefill
private
def value_integerable
Integer(value)
rescue ArgumentError
errors.add(:value, :not_integerable)
end
end