Sunday, June 15, 2014

Gravatar

Adding a Gravatar to our Nesta Blog Post

from
http://www.markholmberg.com/articles/gravatar-and-ruby-on-rails
The quick and dirty 
There are many configurable options that you can pass into Gravtastic. I found it quite refreshing to have a gem just work "out-of-the-box". It also has support for plain ruby if you're not using something like rails. Also, if you want to have the gravatar load on the client side, it has an option to work using javascript if your using Rails 3.1 or higher. 
Gemfile  
gem 'gravtastic'
Model 
user.rb
include Gravtastic
has_gravatar 
View 
_comment.html.haml
= image_tag @comment.user.gravatar_url

1 comment:

  1. Post comments and track them by registering on gravatar, many sites have enabled gravatar comments on their site. Easy for SEO professionals,bloggers and commentators

    ReplyDelete