1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

gets rid of a double negation, no need to force exactly true/false in a predicate

This commit is contained in:
Xavier Noria 2010-09-12 00:57:45 +02:00
parent 11710c0d7d
commit 0aa66f04e4

View file

@ -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?