Created
June 14, 2013 02:49
-
-
Save victorbstan/5779141 to your computer and use it in GitHub Desktop.
A module for defaulting to a gravatar image when your profile's own paperclip image isn't available.
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
require 'digest/md5' | |
module ProfilePhoto | |
def profile_photo(profile) | |
profile.avatar.url(:thumb).present? ? profile.avatar.url(:thumb) : "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(profile.owner.email)}?d=mm" | |
end | |
end | |
# in your application_helper use: | |
# module ApplicationHelper | |
# include ProfilePhoto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment