Last active
August 29, 2015 13:57
-
-
Save brunojabs/9787065 to your computer and use it in GitHub Desktop.
Rails validations to email and telephone number formats
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
validates :zipcode, format: { with: /[0-9]{5}-[0-9]{3}/ } | |
validates :phone, format: { with: /\(?[0-9]{2}\)? ?[0-9]{4,5}-?[0-9]{4}/ } | |
validates :email, format: { with: /\A.+@.+\..+\z/ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment