aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-03-25 00:17:16 +0100
committerXavier Noria <fxn@hashref.com>2012-03-25 00:22:04 +0100
commit3756a3fdfe8d339a53bf347487342f93fd9e1edb (patch)
treee28225ac1edf8855a09e225caba43730cecba6b7 /actionpack/lib
parent014498e1d74decd57d44d45c187fa4f4b968b811 (diff)
downloadrails-3756a3fdfe8d339a53bf347487342f93fd9e1edb.tar.gz
rails-3756a3fdfe8d339a53bf347487342f93fd9e1edb.tar.bz2
rails-3756a3fdfe8d339a53bf347487342f93fd9e1edb.zip
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.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb2
1 files changed, 1 insertions, 1 deletions
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?