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:
parent
11710c0d7d
commit
0aa66f04e4
1 changed files with 4 additions and 4 deletions
|
@ -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?
|
||||
|
||||
|
|
Loading…
Reference in a new issue