Last Updated: February 25, 2016
·
1.176K
· opetznick

Render Devise Controllers without Layout on XHR Requests

Open your application_controller.rb and add following code:

layout :layout

private

def layout
  request.xhr? && devise_controller? ? false : "application"
end

Your next ajax request will be without layout - just the template.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

Account takeover often starts in the browser, on the login page itself. A malicious script can read credentials, tokens, or one-time codes as the person types them.

Security insights from Cside