Skip to content
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

Force ActionDispatch::Request#xhr? to return true or false #19424

Closed
wants to merge 1 commit into from

Conversation

r7kamura
Copy link
Contributor

The ActionDispatch::Request#xhr? comment lines say "Return true if ...", but in fact it returns 0 instead of true. This is because String#=~ returns Fixnum or nil. I think it should always return true or false only, so I replaced it with Regexp#===.

The `ActionDispatch::Request#xhr?` comment lines say "Return true if ...",
but in fact it returns 0 instead of `true`.
This is because `String#=~` returns Fixnum or `nil`.

I think it should always return `true` or `false` only,
so I replaced it with `Regexp#===`.
@kaspth
Copy link
Contributor

kaspth commented Mar 20, 2015

Thanks, but 0 evaluates as true in Ruby and we're fine with that ❤️

@kaspth kaspth closed this Mar 20, 2015
@s-aida
Copy link
Contributor

s-aida commented Mar 20, 2015

#6639
#5329
#7510
#13206
#9670
#17181

This seems to be a hot spot.

@r7kamura
Copy link
Contributor Author

@shunsukeaida Thanks! I haven't read them 😍

@r7kamura
Copy link
Contributor Author

@kaspth OK, I see. Thanks for your quick response! 👍

@r7kamura r7kamura deleted the request-xhr-boolean branch June 13, 2016 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants