Module: Workarea::User::Avatar

Extended by:
ActiveSupport::Concern
Included in:
Workarea::User
Defined in:
app/models/workarea/user/avatar.rb

Instance Method Summary collapse

Instance Method Details

#avatar_image_urlObject



15
16
17
18
19
20
21
22
23
# File 'app/models/workarea/user/avatar.rb', line 15

def avatar_image_url
  if avatar.present?
    avatar.process(:avatar).url
  elsif !Rails.env.test?
    gravatar_url
  else
    'workarea/core/placeholder.png'
  end
end

#gravatar_url(options = {}) ⇒ Object



25
26
27
28
29
# File 'app/models/workarea/user/avatar.rb', line 25

def gravatar_url(options = {})
  options = Workarea.config.gravatar_options.merge(options)
  hash = Digest::MD5.hexdigest(email.downcase)
  "https://www.gravatar.com/avatar/#{hash}?#{options.to_query}"
end