Sha256: 03942b5db87aee19ba0e23cb884ce70d5e79f18a9da387f6976bcd63794778c4

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable, :lockable and :timeoutable
  devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

  serialize :roles, Array

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

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

  def attr_accessible_role
    :custom_role
  end

  def roles_enum
    [:admin, :user]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin-0.6.0 spec/dummy_app/app/active_record/user.rb
rails_admin-0.5.0 spec/dummy_app/app/active_record/user.rb