diff options
author | Rémy Coutable <remy@rymai.me> | 2016-02-09 19:59:47 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-02-09 20:15:35 +0300 |
commit | b3635ee46a1e62d72ce84871e2a5984e6eabfbdf (patch) | |
tree | da9f077646a7baa0b0aee9f7c2412fe271ac9814 /app/validators/email_validator.rb | |
parent | b34963bc125d11af7b9c993d1233258f084e580d (diff) |
Re-add EmailValidator to avoid the repetition of format: { with: Devise.email_regexp }
Diffstat (limited to 'app/validators/email_validator.rb')
-rw-r--r-- | app/validators/email_validator.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb new file mode 100644 index 00000000000..aab07a7ece4 --- /dev/null +++ b/app/validators/email_validator.rb @@ -0,0 +1,5 @@ +class EmailValidator < ActiveModel::EachValidator + def validate_each(record, attribute, value) + record.errors.add(attribute, :invalid) unless value =~ Devise.email_regexp + end +end |