New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed request.xhr? to return boolean instead of 0 or nil #9670
Conversation
… the index instead of boolean.
not a bug, this PR has been made before (#5329) and has been rejected |
It is really confuse that a method with suffix Btw: https://github.com/rack/rack/blob/master/lib/rack/request.rb#L308 |
@pixeltrix What do you think to replace word in the comment from the http://apidock.com/rails/ActionDispatch/Request/xml_http_request%3F |
That's how predicates are documented: "returns true if...", "says whether...". In the very exceptional cases when you really want to commit or refer to the |
@fxn What were the conditions to use the Regexp? If only for case issue, so to use |
The method checks for case-insensitive inclusion, not sure if that is needed though. I didn't write the original method and don't see any test checking inclusion. Bear in mind that no matter how you rewrite it, the method does not document singletons. So even in the case of a refactor that returned singletons you still could not rely on them, the same way people cannot rely on |
@fxn I don't care about return value now, just performance issue. |
Changed return values for
request.xhr?
totrue
orfalse
instead ofnil
and0
.