to_params broken for Arrays
Reported by spicyj | July 16th, 2008 @ 01:25 AM | in 0.9.5
Currently,
Merb::Request.query_parse("people[][a]=1&people[][b]=2")
#=> {"people"=>[{"a"=>"1"}, {"b"=>"2"}]}
{"people"=>[{"a"=>"1"}, {"b"=>"2"}]}.to_params
#=> "people=a1b2"
Obviously this can't be the correct behaviour.
Although, I'd like also for this, like Rails does:
Merb::Request.query_parse("people[0][a]=1&people[0][b]=2&people[1][a]=3&people[1][b]=4")
#=> {"people"=>[{"a"=>"1", "b"=>"2"}, {"a"=>"1", "b"=>"2"}]}
Comments and changes to this ticket
-
Michael Klishin (antares) July 16th, 2008 @ 09:50 PM
- → State changed from new to open
- → Milestone changed from to 0.9.4
-
Michael Klishin (antares) August 2nd, 2008 @ 06:55 PM
- → Milestone changed from 0.9.4 to 0.9.5
-
monki (Wesley Beary) August 17th, 2008 @ 01:58 AM
I have a fix ready for this.
Should it patch against wycats/merb-extlib or sam/extlib? (if sam/extlib I have commit rights, but would you prefer I push it through here/you?)
Thanks, wes
-
Michael Klishin (antares) August 17th, 2008 @ 08:30 AM
Against extlib, merb-extlib is no longer used.
-
monki (Wesley Beary) August 17th, 2008 @ 10:37 AM
That's what I was thinking (I guess I could have checked).
Should I go ahead and push the change or would you prefer a patch?
-
Michael Klishin (antares) August 17th, 2008 @ 10:56 AM
I'd be happy to review changes first so if you can make a patch, go for it.
-
-
Michael Klishin (antares) August 18th, 2008 @ 12:53 AM
- → Assigned user changed from to Michael Klishin (antares)
- → State changed from open to resolved
Pushed, thank you. If you can add more spec examples for this method, go for it, it'd help a lot.
-
monki (Wesley Beary) August 18th, 2008 @ 01:42 AM
Thanks. Added some more specs (I used the test hash/param strings from merb-core/specs/public/request/request_spec, figured if the two things agree on all of those we are probably in good shape). I went ahead and pushed the changes myself, since I figured that passing specs probably didn't need review. Let me know if you have any concerns.
-
Michael Klishin (antares) August 18th, 2008 @ 01:49 AM
Passing specs do not need review all the time but for methods like this we better have as many spec examples as possible. There are crazy edge cases with this URL params hell :)
-
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
