demarches-normaliennes/app/models/champs/email_champ.rb
2024-02-19 15:13:20 +01:00

5 lines
247 B
Ruby

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?
end