summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-01-20 21:39:01 -0700
committermo khan <mo@mokhan.ca>2015-01-20 21:39:01 -0700
commit781667e3f3dcbafcfe258cf42b1fc8fa13351e0b (patch)
tree67983b4b0498d584503b75d86c4318318f3aee79
parentf8ea2234d61667a36dc2dfdad54dee98fdc9225e (diff)
replace email validator with a gem.
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock3
-rw-r--r--app/models/email_validator.rb8
3 files changed, 4 insertions, 8 deletions
diff --git a/Gemfile b/Gemfile
index 71f0068d..4e885cd2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -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
-