Created
June 6, 2011 17:18
-
-
Save Znow/1010659 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i # full regex | |
| validates :name, :length => { :maximum => 50 }, | |
| :presence => true # a validation of :name has to be present and a max character length of 50 | |
| validates :email, :format => { :with => email_regex }, | |
| :uniqueness => { :case_sensitive => false }, # email has to be unique, and it does not effect if case | |
| :presence => true | |
| validates :password, :presence => true, | |
| :on => :create, | |
| :confirmation => true, # it needs a confirmation | |
| :length => { :within => 6..40 } # the length has to be WITHIN 6-40 characters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment