Module: Guts::UsersHelper

Defined in:
app/helpers/guts/users_helper.rb

Overview

View helpers for users

Instance Method Summary collapse

Instance Method Details

#gravatar_for(user) ⇒ String

Note:

Sets a class of ‘gravatar` to the image HTML

Gets the user’s gravatar

Parameters:

  • user (Object)

    the user’s object

Returns:

  • (String)

    the image HTML



8
9
10
11
12
13
# File 'app/helpers/guts/users_helper.rb', line 8

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