Where are the views for Devise in a Rails app?

Written on August 5, 2018

Devise is a sweet gem that provides authentication for a Rails application.

One of the things that I couldn’t figure out when I first started using Devise, is where the various views that Devise rendered came from. Going to the app/views folder didn’t reveal anything obvious.

It turns out according to the gem documentation, that Devise packages all of its views inside the gem itself. Meaning by default you can’t make changes to the views that Devise renders.

Turns out you can get Devise to dump and use the view files locally within your Rails app. To do that you’ll want to run this command from the command-line from within your application project folder:

$ rails generate devise:views

Running the command above will now create a subfolder called devise within your app/views folder. Now you can tweak the look and feel of the login and registration views.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image