# Install Devise Masqerade

### Assumptions:

* You have Devise installed
* You're using Administrate for the admin area



[https://github.com/oivoodoo/devise\_masquerade](https://github.com/oivoodoo/devise_masquerade)

[https://www.youtube.com/watch?v=C03adOMm-EA](https://www.youtube.com/watch?v=C03adOMm-EA)

Here's what I did:

* Installed the gem
* Added the following line to `app/views/admin/application/show.html.erb`

```
<% if params[:controller] == 'admin/users' && params[:action] == 'show' %>
  <%= link_to "Impersonate User", masquerade_path(page.resource), class: "button" %>
<% end %>
```

*   Added this to app/models/user.rb

    &#x20; `, :masqueradable`
* Add the following to `app/views/layouts/application.html.erb` (or somewhere at the top of the DOM):

```
<% if user_masquerade? %>
  <div style="background: #eee;font-size: 10px; padding: 8px; position: fixed; bottom: 0; left: 0; z-index:9999;"><%= link_to "Stop impersonate", back_masquerade_path(current_user) %></div>
<% end %>
```
