# Problems parsing data from deeply-nested forms

**URL:** <https://www.ruby-forum.com/t/problems-parsing-data-from-deeply-nested-forms/121453>\
**Category:** Rails\
**Created:** [November 28, 2007, 4:20am UTC](https://www.ruby-forum.com/t/problems-parsing-data-from-deeply-nested-forms/121453 "2007-11-28T04:20:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [November 28, 2007, 4:20am UTC](https://www.ruby-forum.com/t/problems-parsing-data-from-deeply-nested-forms/121453/1 "2007-11-28T04:20:53Z")

</div>

I have the following failing test case in  
actionpack/test/controller\_test.rb (edge):

{{{  
def test\_deep\_query\_string\_with\_array\_of\_hashes\_with\_hash\_values  
query\_string = ‘x[y][][z]=1&x[y][][w][a]=2&x[y][][w][b]=3’  
assert\_equal(  
{“x” =\> {“y” =\> [{“z” =\> “1”, “w” =\> {“a”=\>“2”, “b”=\>“3”}}]}},  
ActionController::AbstractRequest.parse\_query\_parameters(query\_string)  
)  
end

\<{“x”=\>{“y”=\>[{“w”=\>{“a”=\>“2”, “b”=\>“3”}, “z”=\>“1”}]}}\> expected but was  
\<{“x”=\>{“y”=\>[{“w”=\>{}, “z”=\>“1”}, {“w”=\>{}}]}}\>.  
}}}

The deeply-nested query strings like the one above arise from  
correspondingly deeply-nested forms, built using fields\_for, that allow  
users to create complex models with all of their associations at once.  
I’d like to be able to have that form functionality, but not have to  
resort to hacking the params layout.

Does the test cast above make sense - i.e. is the expection reasonable?  
If so, does anyone have any thought on how to tackle this problem?  
Perhaps this is just too must nesting?
