Skip to content

Commit

Permalink
Revert "Return an actual boolean from xml_http_request?"
Browse files Browse the repository at this point in the history
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 rails#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
fxn committed Mar 24, 2012
1 parent 014498e commit 3756a3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/http/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
alias :xhr? :xml_http_request?

Expand Down

0 comments on commit 3756a3f

Please sign in to comment.