So, I needed to work this out the other day and a lot of the Rails plugins didn't seem to do the job. However, it turned out to be quite simple anyway.

The Helper

Presuming you have a "Comment" model you need to put the following code in you "comments_helper" file:-">

As you can see, you need to 'require' the md5 library. This is used to create the md5 hash of the email address, which is then used in the construction of the gravatar URL.
The View

Then you can simply use this help in your view using:-">

Obviously you will need to substitute "" for whatever your email field is called.

There are many ways in which the helper could be improved upon, but this example just has the minimum to keep things simple.