简体   繁体   中英

How to skip layout with devise?

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  layout :check_layout

  def check_layout
    return nil if request.xhr?
    'application'
  end
end

Devise ignores this condition and renders layout. How to fix?

// upd

Now trying in config/application.rb - still ignores for sign_in and sign_up ;(

config.to_prepare do
  Devise::SessionsController.layout nil
  Devise::RegistrationsController.layout nil
end

Use layout false to render no layout.

layout nil will force default layout behavior with inheritance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM