Rails & Devise: How to render login page without a layout?
You can also create a sessions.html.erb file in app/views/layouts/devise. That layout will then be used for just the sign in screen.
You can subclass the controller and configure the router to use that:
class SessionsController < Devise::SessionsController
layout false
end
And in config/routes.rb
:
devise_for :users, :controllers => { :sessions => "sessions" }
You need to move the session views to this controller too.
OR make a method in app/controllers/application_controller.rb
:
class ApplicationController < ActionController::Base
layout :layout
private
def layout
# only turn it off for login pages:
is_a?(Devise::SessionsController) ? false : "application"
# or turn layout off for every devise controller:
devise_controller? && "application"
end
end