Skip to content

Instantly share code, notes, and snippets.

@azuby
Created July 25, 2011 08:23
Show Gist options
  • Save azuby/1103758 to your computer and use it in GitHub Desktop.
Save azuby/1103758 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
has_secure_password
attr_accessible :name, :email, :password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :name, :presence => true,
:length => { :maximum => 50 }
validates :email, :presence => true,
:format => { :with => email_regex },
:uniqueness => { :case_sensitive => false}
validates :password, :presence => true,
:length => { :within => 6..40 }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment