Sha256: 29660b3151902926765dddee58b1bec4b4fc368b817878481bef1c1905bf6f3c

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

class User
  include Mongoid::Document
  include Mongoid::Paperclip
  include ActiveModel::ForbiddenAttributesProtection
  # 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
  field :encrypted_password, type: String

  ## 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

  # 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 delete_avatar == '1' }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_admin-0.6.4 spec/dummy_app/app/mongoid/user.rb
rails_admin-0.6.3 spec/dummy_app/app/mongoid/user.rb
rails_admin-0.6.2 spec/dummy_app/app/mongoid/user.rb