Class: SavedProgressValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- SavedProgressValidator
- Defined in:
- app/validators/saved_progress_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'app/validators/saved_progress_validator.rb', line 2 def validate(record) regex = URI::MailTo::EMAIL_REGEXP if record.email.match(regex).nil? record.errors.add(:email, I18n.t('presenter.save_and_return.validation.email')) end if record.secret_answer.length > 100 record.errors.add(:secret_answer, I18n.t('presenter.save_and_return.validation.answer_too_long', attribute: 'Secret answer')) end end |