Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Rack::Utils.build_nested_query with integer values #557

cyx opened this Issue · 5 comments

5 participants



Not sure if this is intended behavior, but if you try to use build_nested_query like so:

Rack::Utils.build_nested_query("foo" => 1)
# => "foo"

Rack::Utils.build_nested_query("foo" => { "bar" => 1})
# => "foo[bar]"

It drops the value silently. If you think this is a bug, I can do a pull request or something. Thanks!



Right now I just use my own wrapper to avoid having values silently discarded here, but it would be great if Rack did this check in the body of the else branch:


I agree on this one, I was talking with @raggi about it. I will wait for him just in case.
Anyway you can provide a PR, it's an easy fix and probably better for James to follow.

I did an sketch fix here feel free to reuse that one if you want.



Looks fine to me.

@michaelsauter michaelsauter referenced this issue from a commit in sitepoint/the86-client
@michaelsauter michaelsauter Use build_nested_query, of course
Not quite sure why I assumed build_query would work. I guess
because the tests passed and the tests failed when I used
build_nested query. The issue then however was a bug in rack
(see rack/rack#557), for which this
commit provides a quick fix.

+1 Ended up having to do the same workaround as @michaelsauter above.



@raggi raggi closed this in c34b579
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.