Search code examples
ruby-on-railsgravatar

Permanent gravatar in views for a specific admin user


To implement a gravatar for an instance of user is <%= gravatar_for @user %>.

What if I wanted to specify another user, an admin user, who would have a permanent gravatar in the views of all regular users. How would I go about implementing this?


Solution

  • You'd have to either pull the admin user out of the database and use gravatar_for(@admin_user) or just hardcode the gravatar URL into an image_tag.

    Do the latter if you can get away with it.