18F/identity-dashboard

View on GitHub
app/validators/user_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class UserValidator < ActiveModel::Validator
  def validate(record)
    return unless User.where(email: record.email).exists?
    record.errors.add(:email, I18n.t('notices.user_already_exists'))
  end
end