Optimisation: pages are displayed without layout, when called from a xhr request.
Should be useful to speed up paginations
This commit is contained in:
parent
69dcb84780
commit
a9c5d6bc55
@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery prepend: true, with: :exception
|
||||
|
||||
layout :handle_xhr_layout
|
||||
|
||||
private
|
||||
|
||||
def set_locale
|
||||
@ -26,4 +28,9 @@ class ApplicationController < ActionController::Base
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
end
|
||||
|
||||
# If the request is an xhr, we don't render any layout
|
||||
def handle_xhr_layout
|
||||
request.xhr? ? false : 'application'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user