/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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}/