diff options
author | Xavier Noria <fxn@hashref.com> | 2010-09-12 00:57:45 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-09-12 00:58:29 +0200 |
commit | 0aa66f04e4b4698718023cacb18612e04a4c5eb1 (patch) | |
tree | 67ad3fdd1eedf49284bb01e7e2c79e122ece826b /actionpack/lib | |
parent | 11710c0d7d9e9c86a1a3be069bed8819a6bcbafa (diff) | |
download | rails-0aa66f04e4b4698718023cacb18612e04a4c5eb1.tar.gz rails-0aa66f04e4b4698718023cacb18612e04a4c5eb1.tar.bz2 rails-0aa66f04e4b4698718023cacb18612e04a4c5eb1.zip |
gets rid of a double negation, no need to force exactly true/false in a predicate
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 5606d6abfe..789ecfdbd9 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -136,11 +136,11 @@ module ActionDispatch super.to_i end - # Returns true if the request's "X-Requested-With" header contains - # "XMLHttpRequest". (The Prototype Javascript library sends this header with - # every Ajax request.) + # 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) + @env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i end alias :xhr? :xml_http_request? |