Skip to content

Fix #to_query to not include = for nil values #53962

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

Merged
merged 1 commit into from
Dec 15, 2024
Merged

Conversation

byroot
Copy link
Member

@byroot byroot commented Dec 15, 2024

Fix: #28322

This is more consistent with the behavior of Rack::Utils.parse_nested_query.

Fix: rails#28322

This is more consistent with the behavior of `Rack::Utils.parse_nested_query`.

Co-Authored-By: Erol Fornoles <erol.fornoles@gmail.com>
@byroot byroot merged commit abdbff5 into rails:main Dec 15, 2024
2 of 3 checks passed
@byroot byroot deleted the nil-to-query branch December 15, 2024 15:41
seanpdoyle added a commit to seanpdoyle/activeresource that referenced this pull request Jan 5, 2025
Follow-up to rails/rails#53962

As of [abdbff4][], calls to [Hash#to_query][] with `nil` values will
omit the joining `=` character.

This change resolves [CI failures][] for Rails past `rails@8.1` like:

```
  1) Failure:
BaseTest#test_collection_path_with_parameters [test/cases/base_test.rb:779]:
Expected: "/people.json?gender="
  Actual: "/people.json?gender"

  2) Failure:
SingletonTest#test_singleton_path_with_parameters [test/singleton_test.rb:44]:
Expected: "/weather.json?degrees="
  Actual: "/weather.json?degrees"
```

[abdbff5]: rails/rails@abdbff5
[Hash#to_query]: https://edgeapi.rubyonrails.org/classes/Hash.html#method-i-to_query
[CI failures]: https://github.com/rails/activeresource/actions/runs/12606260018/job/35136128961?pr=411#step:4:17
matthewd added a commit to matthewd/rails that referenced this pull request Jan 23, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
matthewd added a commit to matthewd/rails that referenced this pull request Feb 11, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
matthewd added a commit to matthewd/rails that referenced this pull request Mar 20, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 14, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 16, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 16, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 17, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 17, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 17, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 17, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 22, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 22, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 22, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 22, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 22, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 22, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 23, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
mgriffin added a commit to mgriffin/rails that referenced this pull request Apr 23, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
peter-evans pushed a commit to peter-evans/rails that referenced this pull request Apr 24, 2025
This reverts commit abdbff5, reversing
changes made to 8e7627a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NilClass.to_query(key) does not round-trip with Rack::Utils.parse_nested_query
2 participants