Created
April 11, 2013 16:43
-
-
Save rogeliog/5365021 to your computer and use it in GitHub Desktop.
Gravatar
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
application_helper.rb | |
def avatar_url(user) | |
if user.avatar_url.present? | |
user.avatar_url | |
else | |
default_url = "#{root_url}images/guest.png" | |
gravatar_id = Digest::MD5.hexdigest(user.email.downcase) | |
"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment