Sha256: 2e61bebcf477cd742e5b2b2a0799e6cb590a11244c01021e9eec8b12a33cde36

Contents?: true

Size: 484 Bytes

Versions: 4

Compression:

Stored size: 484 Bytes

Contents

module Guts
  # View helpers for users
  module UsersHelper
    # Gets the user's gravatar
    # @param [Object] user the user's object
    # @return [String] the image HTML
    # @note Sets a class of `gravatar` to the image HTML
    def gravatar_for(user)
      gravatar_id  = Digest::MD5::hexdigest user.email.downcase
      gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
      
      image_tag gravatar_url, alt: user.name, class: "gravatar"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guts-1.0.8 app/helpers/guts/users_helper.rb
guts-1.0.7 app/helpers/guts/users_helper.rb
guts-1.0.5 app/helpers/guts/users_helper.rb
guts-1.0.3 app/helpers/guts/users_helper.rb