Sha256: 140e53d7cc27520987b802cedef4a45926b6cd6a8fbe8f951572085e81b4876a

Contents?: true

Size: 910 Bytes

Versions: 7

Compression:

Stored size: 910 Bytes

Contents

class User < ActiveRecord::Base
  devise :database_authenticatable, :confirmable, :lockable, #:timeoutable,
         :recoverable, :rememberable, :trackable, :validatable, :registerable,
         :encryptable, encryptor: :sha512

  attr_accessible :password, :password_confirmation, :email, :remember_me,
                  :login, :first_name, :last_name, :patronymic, :phone, :skype, :web_site, :address, :birthday,
                  :time_zone, :locale, :bg_color, :gender


  attr_accessible :user_role_id, :trust_state, as: :admin

  include AbAdmin::Concerns::AdminAddition
  include AbAdmin::Models::User

  fileuploads :avatar

  def init
    set_default_role
    self.trust_state ||= ::UserState.pending.id
    self.locale ||= 'ru'
    self.time_zone ||= 'Kiev'
  end

  def password_required?
    return true if password.present?
    return false if persisted? && password.blank?
    super
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.3.6 lib/generators/ab_admin/install/templates/models/user.rb
ab_admin-0.3.5 lib/generators/ab_admin/install/templates/models/user.rb
ab_admin-0.3.4 lib/generators/ab_admin/install/templates/models/user.rb
ab_admin-0.3.3 lib/generators/ab_admin/install/templates/models/user.rb
ab_admin-0.3.2 lib/generators/ab_admin/install/templates/models/user.rb
ab_admin-0.3.1 lib/generators/ab_admin/install/templates/models/user.rb
ab_admin-0.3.0 lib/generators/ab_admin/install/templates/models/user.rb