Skip to content

Instantly share code, notes, and snippets.

@andyl
Created May 11, 2011 23:33
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 andyl/967624 to your computer and use it in GitHub Desktop.
Save andyl/967624 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
# ----- Devise -----
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable #, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
attr_accessible :login, :first_name, :last_name
attr_accessor :login
# ----- Associations -----
has_many :addresses
has_many :phones
has_many :emails
has_many :roles
has_many :photos
has_many :do_avails
has_many :do_assignments
has_many :messages
has_many :distributions
# ----- Validations -----
validates_presence_of :first_name, :last_name, :login
validates_format_of :first_name, :with => /^[A-Za-z \.]+$/
validates_format_of :last_name, :with => /^[A-Za-z \.]+$/
validates_format_of :login, :with => /^[a-z\.]+$/
# validates_uniqueness_of :login
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment