Al Rowan wrote:
> class User < ActiveRecord::Base
>   attr_accessor :password
> 
>   validates :email, :uniqueness => true,
>                     :length => { :within => 5..50 },
>                     :format => { :with => 
> /^...@][\w.-]+@[\w.-]+[.][a-z]{2,4}$/i }
[...]

Separate issue, but a pet peeve of mine: your e-mail validation regexp 
is *incorrect*.  It will reject lots of valid e-mail addresses 
(including anything with pluscoding).  Valid e-mail addresses can take 
far more forms than most people realize, so that the only correct e-mail 
validation regexps I'm aware of are about a page in length.

With that in mind, then, I recommend not doing this kind of format 
checking on e-mail addresses.  If you must use a regexp, just use 
something like /@.+\./ , or simply forget the regexp and e-mail an 
activation code to the address as a means of verifying it.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to