You need to have an e-mail address registered with Gravatar for this to work. If you do not already have one you can go to gravatar.com.
Open up your gemfile and under your devise
gem add
gem 'gravtastic'
In the terminal run
bundle install
This will install the gravtastic gem. Then remember to restart your rails server.
Open app/models/user.rb
, and add these lines
include Gravtastic
gravtastic
right after class User < ApplicationRecord
.
Open app/views/layouts/application.html.erb
and right under
<% if user_signed_in? %>
add
<%= image_tag current_user.gravatar_url, size: "20x20" %>
Now open you app in your browser and login with an e-mail address that is associated with a Gravatar. You should be able to see your Gravatar.