From 6caf8ef8e84bc534f1a1d6dc33b80fe47465adf2 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Fri, 27 Jan 2012 13:12:23 -0800 Subject: [PATCH] Validate email using validates_formatting_of --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index d0b5a46..9523e46 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,7 +4,7 @@ class User < ActiveRecord::Base attr_accessible :address_1, :address_2, :city, :email, :name, :organization, :password, :password_confirmation, :remember_me, :sms_number, :state, :voice_number, :zip - validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i + validates_formatting_of :email, :using => :email validates_formatting_of :sms_number, :using => :us_phone, :allow_blank => true validates_formatting_of :voice_number, :using => :us_phone, :allow_blank => true validates_formatting_of :zip, :using => :us_zip, :allow_blank => true