Created
August 23, 2012 06:36
-
-
Save AdamBrodzinski/3433461 to your computer and use it in GitHub Desktop.
Gravatar Rails Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# returns the Gravatar for the given user. | |
def gravatar_for(user) | |
gravatar_id = Digest::MD5::hexdigest(user.email.downcase) | |
gravatar_url = "http://gravatar.com/avatar/#{gravatar_id}" | |
image_tag(gravatar_url, alt: user.name, class:"gravatar") | |
end | |
# This is a small rails helper that returns a users gravatar image | |
# image alt text defaults to user.name, but can easily be changed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment