Views specifies for Devise

Asked

Viewed 146 times

1

In my project I am using the Rails 5.1.1 and the Devise for login. My question is how I can make a View ,so that the Devise uses as layout, without being the application.html.erb?

  • You generated custom Devise views?

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

0

Create an app/views/layouts/Devise.html.erb file and it will already be used as a layout for the views of the controller.

0

Can also be done:

rails g devise:views user

And for controllers

rails g devise:controllers user

on the routes gets:

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

Remembering that 'user' is the model that is managed by Developer in your project

Browser other questions tagged

You are not signed in. Login or sign up in order to post.