2018-02-13 18:18:20 +01:00
|
|
|
class Champs::EmailChamp < Champs::TextChamp
|
2024-02-15 09:45:20 +01:00
|
|
|
include EmailSanitizableConcern
|
|
|
|
before_validation -> { sanitize_email(:value) }
|
2024-04-01 07:36:14 +02:00
|
|
|
# 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
|