debian-mirror-gitlab/app/validators/email_validator.rb
2016-04-02 18:10:28 +05:30

5 lines
185 B
Ruby

class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add(attribute, :invalid) unless value =~ Devise.email_regexp
end
end