Class: EmailConfirmationValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/validators/email_confirmation_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



2
3
4
5
6
7
# File 'app/validators/email_confirmation_validator.rb', line 2

def validate(record)
  regex = URI::MailTo::EMAIL_REGEXP
  if record.email_confirmation.match(regex).nil?
    record.errors.add(:email_confirmation, I18n.t('presenter.save_and_return.validation.email'))
  end
end