Created
July 18, 2017 22:16
-
-
Save rndev15/ca0d25597ac8ff8a63380a24c8f95ac4 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
validates :msisdn1, :msisdn2, :msisdn3, format: { with: /(\+7|8)\d{10}/ }, if: :russian? | |
validates :msisdn1, :msisdn2, :msisdn3, length: { minimum: 8, maximum: 16 }, unless: :russian? | |
def russian? | |
starts_with?("+7", "8") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment