Created
May 30, 2011 21:14
-
-
Save anonymous/999482 to your computer and use it in GitHub Desktop.
Patching render to disable the layout if PJAX request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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