flintinatux/importr

View on GitHub
app/helpers/users_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
module UsersHelper

  # Returns the Gravatar (http://gravatar.com/) for the given user
  def gravatar_for(user, options = { size: 50 })
    gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
    size = options[:size]
    gravatar_url = "http://secure.gravatar.com/avatar/#{gravatar_id}?d=mm&r=g&s=#{size}"
    image_tag(gravatar_url, alt: user.name, class: "gravatar")
  end
end