EvanHahn

user.rb

Dec 31st, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.75 KB | None | 0 0
  1. class User
  2.  
  3.   include Mongoid::Document
  4.  
  5.   field :name, :type => String
  6.   validates_presence_of :name
  7.  
  8.   # Include default devise modules. Others available are:
  9.   # :token_authenticatable, :confirmable,
  10.   # :lockable, :timeoutable and :omniauthable
  11.   devise :database_authenticatable, :registerable,
  12.          :recoverable, :rememberable, :trackable, :validatable
  13.  
  14.   ## Database authenticatable
  15.   field :email,              :type => String, :default => ''
  16.   field :encrypted_password, :type => String, :default => ''
  17.  
  18.   validates_presence_of :email
  19.   validates_presence_of :encrypted_password
  20.   validates_uniqueness_of :name, :email, :case_sensitive => false
  21.   attr_accessible :name, :email, :password, :password_confirmation, :remember_me
  22.  
  23.   ## Recoverable
  24.   field :reset_password_token,   :type => String
  25.   field :reset_password_sent_at, :type => Time
  26.  
  27.   ## Rememberable
  28.   field :remember_created_at, :type => Time
  29.  
  30.   ## Trackable
  31.   field :sign_in_count,      :type => Integer, :default => 0
  32.   field :current_sign_in_at, :type => Time
  33.   field :last_sign_in_at,    :type => Time
  34.   field :current_sign_in_ip, :type => String
  35.   field :last_sign_in_ip,    :type => String
  36.  
  37.   ## Confirmable
  38.   # field :confirmation_token,   :type => String
  39.   # field :confirmed_at,         :type => Time
  40.   # field :confirmation_sent_at, :type => Time
  41.   # field :unconfirmed_email,    :type => String # Only if using reconfirmable
  42.  
  43.   ## Lockable
  44.   # field :failed_attempts, :type => Integer, :default => 0 # Only if lock strategy is :failed_attempts
  45.   # field :unlock_token,    :type => String # Only if unlock strategy is :email or :both
  46.   # field :locked_at,       :type => Time
  47.  
  48.   ## Token authenticatable
  49.   # field :authentication_token, :type => String
  50.  
  51. end
Advertisement
Add Comment
Please, Sign In to add comment