Search code examples
ruby-on-railsgravatar

how do I use a gravatar image as a link using gravatar_for


I know this is a simple question yet I cannot figure out how to do it. I want to use a gravatar_for attendee and have the gravatar link_to the attendee. Just using the gravatar with no link works like this:

<%= gravatar_for attendee, :size => 35 %>

Great. but every time I try to add a link I break it or it doesn't appear correctly. I tried this:

<%= link_to image_tag(gravatar_for attendee, :size => 35) %>

What am I doing wrong?


Solution

  • The problem is probably with your parentheses. Try:

    <%= link_to image_tag(gravatar_for(attendee, :size => 35)) %>