Class: User

Inherits:
ApplicationRecord
  • Object
show all
Includes:
AbAdmin::Concerns::AdminAddition, AbAdmin::Models::User
Defined in:
lib/generators/ab_admin/install/templates/models/user.rb

Instance Method Summary collapse

Methods included from AbAdmin::Models::User

#activate!, #active?, #admin?, #admin_access?, #default?, #full_name, #generate_password!, #has_role?, #moderator?, #name, #redactor?, #set_default_role, #suspend!

Methods included from AbAdmin::Concerns::AdminAddition

#admin_comments_count_non_zero, #for_input_token, #han, #new_changes, #next_prev_by_url, #token_data, #translated_any

Instance Method Details

#initObject


11
12
13
14
15
# File 'lib/generators/ab_admin/install/templates/models/user.rb', line 11

def init
  set_default_role
  self.locale ||= 'ru'
  self.time_zone ||= 'Kiev'
end

#password_required?Boolean

Returns:

  • (Boolean)

17
18
19
20
21
# File 'lib/generators/ab_admin/install/templates/models/user.rb', line 17

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