Posted By

rduv on 09/29/06


Tagged

validate


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

dapan
acookinc
webstic


validate email address


 / Published in: Ruby
 

URL: http://www.rubyonrailsblog.com/

  1. validates_format_of(:email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :on => :create, :message=>"has an invalid format") # AND A LOGIN VALIDATION EXAMPLE MIGHT BE validates_format_of :login, :with => /\w+@\w+\.\w{2}/

Report this snippet  

You need to login to post a comment.