Skip to content

Instantly share code, notes, and snippets.

Created May 30, 2011 21:14
Show Gist options
  • Save anonymous/999482 to your computer and use it in GitHub Desktop.
Save anonymous/999482 to your computer and use it in GitHub Desktop.
Patching render to disable the layout if PJAX request
class ApplicationController < ActionController::Base
...
#We don't want to render the layout if PJAX is working
def render(options = nil, extra_options = {}, &block)
if request.headers['X-PJAX'] == 'true'
options = {} if options.nil?
options[:layout] = false
end
super(options, extra_options, &block)
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment