Array Param Parsing bug
Reported by Andy Delcambre | September 10th, 2008 @ 01:16 AM | in 0.9.8
It appears that the parameter parsing in merb with arrays is a bit broken. If you have a form like the following:
<form method="post" action="/test/create">
<input type="text" name="foo[bar][][baz]" value="1"></input>
<input type="text" name="foo[bar][][zot]" value="2"></input>
<input type="text" name="foo[bar][][baz]" value="3"></input>
<input type="text" name="foo[bar][][zot]" value="4"></input>
<input type="submit">
</formt>
Then I would like to see the params hash to be:
{"foo"=>{"bar"=>[{"baz"=>"1", "zot"=>"2"}, {"baz"=>"3", "zot"=>"4"}]}}
right now the params hash returns:
{"foo"=>{"bar"=>[{"baz"=>"1"}, {"zot"=>"2"}, {"baz"=>"3"}, {"zot"=>"4"}]}}
I have attached a patch for a failing spec for the behavior I would like to see. The new behavior is also the current behavior in rails.
Comments and changes to this ticket
-
Michael Klishin (antares) September 10th, 2008 @ 04:29 AM
- → Milestone changed from to 0.9.8
- → State changed from new to open
-

Fabien Franzen (loob2) September 10th, 2008 @ 05:48 PM
- → State changed from open to resolved
Though we regard this pretty much as an edge case, I've come up with an efficient, somewhat naive, implementation to enable this in HEAD: http://is.gd/2rx2
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 »
