Created
July 27, 2015 04:08
-
-
Save ryrych/335d0a3e2f35841331b3 to your computer and use it in GitHub Desktop.
formatting hashes in Ruby / Rails
This file contains 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
class User < ActiveRecord::Base | |
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i | |
validates :name, presence: true, length: { maximum: 50 } | |
validates :email, presence: true, length: { maximum: 25 }, | |
format: { with: VALID_EMAIL_REGEX } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment