Created
May 11, 2011 23:33
-
-
Save andyl/967624 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
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