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
?
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
?
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
Create an app / views / layouts / devise.html.erb file and it will already be used as the layout for controller views to see.
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