Created
June 25, 2013 22:43
-
-
Save romaimperator/5863143 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Returns true if the "X-Requested-With" header contains "XMLHttpRequest" | |
# (case-insensitive). All major JavaScript libraries send this header with | |
# every Ajax request. | |
def xml_http_request? | |
@env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i | |
end | |
alias :xhr? :xml_http_request? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment