Skip to content

Instantly share code, notes, and snippets.

@jfcalvo
Created April 15, 2013 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfcalvo/5389714 to your computer and use it in GitHub Desktop.
Save jfcalvo/5389714 to your computer and use it in GitHub Desktop.
Validación email Rails (from Rubytutorial.org)
class User < ActiveRecord::Base
attr_accessible :name, :email
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment