Simplifying and fixing parameter parsing in Rails (Or: complex forms don't have to suck forever)

Hi,

A few months ago I fixed a Rails bug that was yielding weird, unexpected results when parsing form parameter names: effectively HWIA semantics were screwing up UrlEncodedPairParser's parameter parsing when dealing with nested values. This fixed the defect in question -- and thus solved my immediate problem -- it raised wider questions about the actual correctness and behavior of Rails' current parameter parsing code.

A colleague of mine recently ran into a related problem when dealing with collections of records in Rails forms, which prompted me to finally do something about the parameter parsing behavior. Now, while I'm sure we're not the only ones hitting this wall, I'm aware that proposals to change to the parameter parsing semantics in Rails is likely to be met with a little caution, hesitation -- possibly even terror. :slight_smile: With that in mind, I've put up a plugin so everybody can give this a go without having to apply any nasty patches:

    http://www.vector-seven.com/git/rails/plugins/form_collections.git

Please see the README (attached) for the full details.

Be gentle, this is an early release that has been cobbled together over the course of a few nights. We may not have everything right here, but that's why it's being proposed as a plugin rather than yet another issue in the tracker. It's hoped this will yield a wider discussion around the semantics of parameter parsing in core Rails, because -- as it stands -- things can get a little screwy.

Looking forward to your feedback, suggestions and/or patches. If this breaks your code in ways you don't expect, or doesn't quite work how you would like/need it to, or if it's missing a feature that you'd kill to have, I'd love to know.

Please be vocal. :slight_smile:

Cheers,
Tom

README (2.52 KB)

Hi thomas,

Sorry to top reply so briefly, but have you seen what david dollar and
co have been discussing in the recent :accessible thread?

http://groups.google.com/group/rubyonrails-core/t/4049b4b313fa8be2

Sounds like your plugin here has some changes which could get merged
along with his stuff.

Michael Koziarski wrote:

Hi thomas,

Sorry to top reply so briefly, but have you seen what david dollar and
co have been discussing in the recent :accessible thread?

http://groups.google.com/group/rubyonrails-core/t/4049b4b313fa8be2

Sounds like your plugin here has some changes which could get merged
along with his stuff.

Sure does. Thanks for pointing that out. Looks like two sides of the same coin. :slight_smile:

Cheers,
T