In my application I’m using gravatar_image_tag to retrieve user’s avatar.

I would like to show a custom image(registered in my assets directory) in case that user do not have an gravatar account.

How could I do it?


Bruno Meira

read or watch Ryan Bates RailsCasts episode #244:

Thx soldier,

I will take a look :smiley:

its about 4 minutes in.

The gravatar_image_tag gem has a configuration point for setting your own default image rather then using the Gravatar default.

You can do it inline like so:

gravatar_image_tag('', :gravatar => { :default => '’ })

Or you configure it globally in an initializer

# config/initilizers/gravatar_image_tag.rb GravatarImageTag.configure do |config|   config.default_image = '’ end

Refer to the README for more information