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

8 lines
290 B
Ruby

# frozen_string_literal: true
class Champs::EmailChamp < Champs::TextChamp
include EmailSanitizableConcern
before_validation -> { sanitize_email(:value) }
validates :value, allow_blank: true, format: { with: StrictEmailValidator::REGEXP }, if: :validate_champ_value_or_prefill?
end