Views specific to Devise

1

In my project I'm using Rails 5.1.1 and Devise to login. My question is how can I make a View, so that Devise uses it as a layout, other than application.html.erb ?

    
asked by anonymous 26.06.2017 / 21:25

3 answers

2

I found the solution:

config.to_prepare do
    Devise::SessionsController.layout "your_layout_name"
    Devise::RegistrationsController.layout "your_layout_name"
    Devise::ConfirmationsController.layout "your_layout_name"
    Devise::UnlocksController.layout "your_layout_name"
    Devise::PasswordsController.layout "your_layout_name"
end
    
27.06.2017 / 14:03
0

Create an app / views / layouts / devise.html.erb file and it will already be used as the layout for controller views to see.

    
13.11.2017 / 02:08
0

It can also be done:

rails g devise:views user

And for controllers

rails g devise:controllers user

on the routes you get:

sessions: 'users/sessions',
registrations: 'users/registrations'

Remembering that 'user' is the template that is managed by devise in your project

    
13.11.2017 / 02:29