Class: Cdx::User
Constant Summary
collapse
- AVAILABLE_ROLES =
Cdx.user_available_roles.freeze
Instance Method Summary
collapse
#has_many_attached, #has_one_attached
Instance Method Details
#avatar_url(style = :thumb) ⇒ Object
27
28
29
|
# File 'app/models/cdx/user.rb', line 27
def avatar_url(style = :thumb)
avatar&.attachment_file_name ? avatar.attachment.url(style) : gravatar_url
end
|
23
24
25
|
# File 'app/models/cdx/user.rb', line 23
def
email_was
end
|
#full_name ⇒ Object
35
36
37
|
# File 'app/models/cdx/user.rb', line 35
def full_name
"#{first_name} #{last_name}".strip
end
|
#gravatar_url ⇒ Object
31
32
33
|
# File 'app/models/cdx/user.rb', line 31
def gravatar_url
"https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}"
end
|
#has_role?(role) ⇒ Boolean
39
40
41
|
# File 'app/models/cdx/user.rb', line 39
def has_role?(role)
roles.include? role.to_s
end
|