diff options
| author | mo khan <mo@mokhan.ca> | 2015-01-20 21:39:01 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-01-20 21:39:01 -0700 |
| commit | 781667e3f3dcbafcfe258cf42b1fc8fa13351e0b (patch) | |
| tree | 67983b4b0498d584503b75d86c4318318f3aee79 | |
| parent | f8ea2234d61667a36dc2dfdad54dee98fdc9225e (diff) | |
replace email validator with a gem.
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 3 | ||||
| -rw-r--r-- | app/models/email_validator.rb | 8 |
3 files changed, 4 insertions, 8 deletions
@@ -43,6 +43,7 @@ gem 'github-markdown' gem 'chartkick' gem 'groupdate' gem 'rack-cors', require: 'rack/cors' +gem 'email_validator' group :development do gem 'capistrano-rails' diff --git a/Gemfile.lock b/Gemfile.lock index daf90ea5..b9f9874c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -131,6 +131,8 @@ GEM dotenv-rails (1.0.2) dotenv (= 1.0.2) ejs (1.1.1) + email_validator (1.5.0) + activemodel equalizer (0.0.9) erubis (2.7.0) exception_notification (4.0.1) @@ -456,6 +458,7 @@ DEPENDENCIES dotenv-deployment dotenv-rails ejs + email_validator exception_notification exifr factory_girl_rails diff --git a/app/models/email_validator.rb b/app/models/email_validator.rb deleted file mode 100644 index 1335d4ba..00000000 --- a/app/models/email_validator.rb +++ /dev/null @@ -1,8 +0,0 @@ -class EmailValidator < ActiveModel::EachValidator - def validate_each(record, attribute, value) - unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i - record.errors[attribute] << (options[:message] || "is not an email") - end - end -end - |
