> For the complete documentation index, see [llms.txt](https://railsgirlskc.gitbook.io/workshop-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://railsgirlskc.gitbook.io/workshop-guide/part-8-add-profile-pics-with-gravatar.md).

# Part 8: Add Profile Pics with Gravatar

#### Important <a href="#important" id="important"></a>

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](http://en.gravatar.com/).

### 1. Add the Gravtastic gem <a href="#id-1-add-the-gravtastic-gem" id="id-1-add-the-gravtastic-gem"></a>

Open up your gemfile and under your `devise` gem add

```ruby
gem 'gravtastic'
```

In the terminal run

```
bundle install
```

This will install the gravtastic gem. Then remember to restart your rails server.

### 2. Set up Gravatar in your app <a href="#id-2-set-up-gravatar-in-your-app" id="id-2-set-up-gravatar-in-your-app"></a>

Open `app/models/user.rb`, and add these lines

```ruby
include Gravtastic
gravtastic
```

right after `class User < ApplicationRecord`.

### 3. Configure Gravatar <a href="#id-3-configure-gravatar" id="id-3-configure-gravatar"></a>

Open `app/views/layouts/application.html.erb` and right under

```ruby
<% if user_signed_in? %>
```

add

```ruby
<%= 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.

![If you don't make a gravatar account, the default icon will show.](https://2726284536-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LINPSpR8sbR6w8tkfOJ%2F-LOkNgqZCmaLgOL1Bzxl%2F-LOkPJJW6cEiNBLl6fJi%2F12-gravatar.PNG?alt=media\&token=681eb837-f2e6-4b5d-9ce1-6149522fed02)

<br>
