Sha256: b1cc499adfd986de038c42915edcac5906120aad1b9290703e00748b4c2ed03f

Contents?: true

Size: 1.94 KB

Versions: 3

Compression:

Stored size: 1.94 KB

Contents

class User
  include Mongoid::Document
  include Mongoid::Paperclip
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable, :lockable and :timeoutable
  devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

  ## Database authenticatable
  field :email,              :type => String, :null => false
  field :encrypted_password, :type => String, :null => false

  ## Recoverable
  field :reset_password_token,   :type => String
  field :reset_password_sent_at, :type => Time

  ## Rememberable
  field :remember_created_at, :type => Time

  ## Trackable
  field :sign_in_count,      :type => Integer
  field :current_sign_in_at, :type => Time
  field :last_sign_in_at,    :type => Time
  field :current_sign_in_ip, :type => String
  field :last_sign_in_ip,    :type => String

  ## Encryptable
  # field :password_salt, :type => String

  ## Confirmable
  # field :confirmation_token,   :type => String
  # field :confirmed_at,         :type => Time
  # field :confirmation_sent_at, :type => Time
  # field :unconfirmed_email,    :type => String # Only if using reconfirmable

  ## Lockable
  # field :failed_attempts, :type => Integer # Only if lock strategy is :failed_attempts
  # field :unlock_token,    :type => String # Only if unlock strategy is :email or :both
  # field :locked_at,       :type => Time

  # Token authenticatable
  # field :authentication_token, :type => String

  ## Invitable
  # field :invitation_token, :type => String

  include Mongoid::Timestamps

  attr_accessible :email, :password, :password_confirmation, :remember_me, :roles, :avatar

  # Add Paperclip support for avatars
  has_mongoid_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }

  field :roles, :type => Array

  def attr_accessible_role
    :custom_role
  end

  attr_accessor :delete_avatar
  before_validation { self.avatar = nil if self.delete_avatar == '1' }
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rails_admin-0.0.3 spec/dummy_app/app/mongoid/user.rb
rails_admin-0.0.2 spec/dummy_app/app/mongoid/user.rb
upstream-rails_admin-1.0.2 spec/dummy_app/app/mongoid/user.rb