Currently “xml_http_request” returns a booleanish value that behaves accordingly when needed but it also breaks the general convention that methods with a “?” postfix should return “true” or “false” values.
currently
request.xml_http_request? # => 0 / nil
new
request.xml_http_request? # => true / false
PR at Make ActionDispatch::Resquest#xml_http_request? actually return a boolean. by lukelex · Pull Request #23865 · rails/rails · GitHub
spaceghost
(Johnneylee Jack Rollins)
February 24, 2016, 9:53pm
2
Doesn't `request.xhr?` cover that?
Pretty sure this is not a general convention that Rails follows. This seemed awful familiar, a quick google search brought me to: attribute_changed? returns nil (instead of false) for unchanged attributes (4.2.1) · Issue #20110 · rails/rails · GitHub (which suggests that this type of issue is raised often).