#373 ✓resolved
Álvaro Gil

Multiple nested params are build wrong

Reported by Álvaro Gil | April 3rd, 2010 @ 12:04 PM

     <html>
      <form method="post" action="/family">
        <div class="couple">
          <div class="parent">
            <select name="user[family][parents][0][][gender]">
              <option selected="selected" value="Mother">Mother</option>
              <option value="Father">Father</option>
            </select>
            <input type="text" value="Alice" name="user[family][parents][0][][name]" />
          </div>
          <div class="parent">
            <select name="user[family][parents][0][][gender]">
              <option value="Mother">Mother</option>
              <option selected="selected" value="Father">Father</option>
            </select>
            <input type="text" value="Michael" name="user[family][parents][0][][name]" />
          </div>
        </div>
        <div class="couple">
          <div class="parent">
            <select name="user[family][parents][1][][gender]">
              <option selected="selected" value="Mother">Mother</option>
              <option value="Father">Father</option>
            </select>
            <input type="text" value="Jenny" name="user[family][parents][1][][name]" />
          </div>
        </div>
        <input type="submit" />
      </form>
     </html>

produces:

   { "user"=> { "family" => { "parents" => {
         "0" => [{"name"=>"Alice"}, {"name"=>"Michael"}, {"gender"=>"Mother"}, {"gender"=>"Father"}], 
         "1" => [{"name"=>"Jenny"}, {"gender"=>"Mother"}]
   }}}}

but should produce:

   { "user" => { "family" => { "parents" => {
            "0" => [ {"name" => "Alice", "gender"=>"Mother"}, {"name" => "Michael", "gender"=>"Father"} ],
            "1" => [ {"name" => "Jenny", "gender"=>"Mother"} ]
   }}}}

I've working on this, you can see the results here:

http://github.com/zevarito/webrat/commit/fa881a88c873f42ada86effa24...

thanks!

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Tags

Pages