demarches-normaliennes/app/models/champs/email_champ.rb

7 lines
324 B
Ruby
Raw Normal View History

2018-02-13 18:18:20 +01:00
class Champs::EmailChamp < Champs::TextChamp
include EmailSanitizableConcern
before_validation -> { sanitize_email(:value) }
# TODO: if: -> { validate_champ_value? || validation_context == :prefill }
2024-02-19 15:11:16 +01:00
validates :value, allow_blank: true, format: { with: StrictEmailValidator::REGEXP }, if: :validate_champ_value?
2018-02-13 18:18:20 +01:00
end