Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Revert "Return an actual boolean from xml_http_request?"

Reason: This commit changes code that was committed some year
and a half ago. The original code is an ordinary predicate
that delegates straight to a boolean operator with no further
unnecessaru adorments, as clearly explained in #5329.

This change also may confuse users who may now believe they can
rely now on singletons, while predicates in Rails rely on
standard Ruby semantics for boolean values and guarantee no
singletons whatsover.

This reverts commit 6349791.
  • Loading branch information...
commit 3756a3fdfe8d339a53bf347487342f93fd9e1edb 1 parent 014498e
@fxn fxn authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  actionpack/lib/action_dispatch/http/request.rb
2  actionpack/lib/action_dispatch/http/request.rb
@@ -154,7 +154,7 @@ def content_length
# (case-insensitive). All major JavaScript libraries send this header with
# every Ajax request.
def xml_http_request?
- /XMLHttpRequest/i === @env['HTTP_X_REQUESTED_WITH']
+ @env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i
alias :xhr? :xml_http_request?
Please sign in to comment.
Something went wrong with that request. Please try again.