Created
May 13, 2012 10:53
-
-
Save kinopyo/2687749 to your computer and use it in GitHub Desktop.
Rails local format validation
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_format_of :locale, with: /^[a-z]{2}(?:-[A-Z]{2})?$/, allow_blank: true | |
# valid: 'ja-JP', 'en' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment