Class: User

Inherits:
ApplicationRecord
  • Object
show all
Includes:
PagesCore::AuthenticableUser, PagesCore::Emailable, PagesCore::HasRoles
Defined in:
app/models/user.rb

Instance Method Summary collapse

Methods included from PagesCore::HasRoles

#role?, #role_names, #role_names=

Methods included from PagesCore::AuthenticableUser

#can_login?, #recovery_codes=, #use_recovery_code!

Instance Method Details

#mark_active!Object



31
32
33
34
35
# File 'app/models/user.rb', line 31

def mark_active!
  return if  &&  > 10.minutes.ago

  update(last_login_at: Time.now.utc)
end

#name_and_emailObject



37
38
39
# File 'app/models/user.rb', line 37

def name_and_email
  "#{name} <#{email}>"
end

#online?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/user.rb', line 41

def online?
   &&  > 15.minutes.ago
end

#realnameObject



45
46
47
# File 'app/models/user.rb', line 45

def realname
  name
end