#469 √ resolved
Andy Delcambre

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

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 »

Tags