Search code examples
ruby-on-railsgravatar

Gravatar Imager Url not Working - Rails


I'm using a gem called 'img_gravatar' to get avatars for my users profiles. The syntax is as follows:

img_gravtar(@user.email)

Which outputs

<img src="http://www.gravatar.com/avatar/747fb50017944a3ca06b77fc2d51ba3b" />

The output is an img tag the works, but the tag is just displayed as text in the browser. How can I fix this?


Solution

  • I would bet you are in Rails3, and the output is escaped HTML.

    try

    img_gravtar(@user.email).html_safe