From 3756a3fdfe8d339a53bf347487342f93fd9e1edb Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 25 Mar 2012 00:17:16 +0100 Subject: 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 6349791d5aaf652631b29f1371701fc2985fda83. --- actionpack/lib/action_dispatch/http/request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 4ac13695bf..796e0dbc45 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -154,7 +154,7 @@ module ActionDispatch # (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? -- cgit v1.2.3