module UsersHelper

Public Instance Methods

gravatar_for(user, options = { size: 50 }) click to toggle source

Returns the Gravatar (gravatar.com/) for the given user.

# File app/helpers/users_helper.rb, line 4
def gravatar_for(user, options = { size: 50 })
  gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
  size = options[:size]
  gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
  image_tag(gravatar_url, alt: user.name, class: "gravatar")
end