Rack::Utils.build_nested_query with integer values #557

Closed
cyx opened this Issue May 15, 2013 · 5 comments

Comments

Projects
None yet
5 participants
@cyx

cyx commented May 15, 2013

Hi,

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!

@tizoc

This comment has been minimized.

Show comment Hide comment
@tizoc

tizoc May 15, 2013

+1

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:

https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L165

tizoc commented May 15, 2013

+1

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:

https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L165

@spastorino

This comment has been minimized.

Show comment Hide comment
@spastorino

spastorino May 16, 2013

Member

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 https://gist.github.com/spastorino/7375c064765c35ec6b23 feel free to reuse that one if you want.

Thanks!

Member

spastorino commented May 16, 2013

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 https://gist.github.com/spastorino/7375c064765c35ec6b23 feel free to reuse that one if you want.

Thanks!

@tizoc

This comment has been minimized.

Show comment Hide comment
@tizoc

tizoc May 16, 2013

Looks fine to me.

tizoc commented May 16, 2013

Looks fine to me.

michaelsauter added a commit to sitepoint/the86-client that referenced this issue Jan 14, 2014

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.
@aaronpk

This comment has been minimized.

Show comment Hide comment
@aaronpk

aaronpk Apr 5, 2014

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

aaronpk commented Apr 5, 2014

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

@OpakAlex

This comment has been minimized.

Show comment Hide comment
@OpakAlex

OpakAlex Jul 8, 2014

+1

OpakAlex commented Jul 8, 2014

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment