Class: Elabs::User

Inherits:
ApplicationRecord show all
Includes:
Concerns::Sluggable
Defined in:
app/models/elabs/user.rb

Direct Known Subclasses

User

Constant Summary collapse

SLUGGABLE_FIELD =
nil
SLUG_FIELD =
:username

Instance Attribute Summary

Attributes inherited from ApplicationRecord

#changed_by

Instance Method Summary collapse

Methods included from Concerns::Sluggable

#fill_slug

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


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

def admin?
  role == 'admin'
end

#display_nameObject



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

def display_name
  real_name.present? ? real_name : "@#{username}"
end

#to_paramObject



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

def to_param
  username
end