Something else I meant to ask when posting this: Does anybody know why on earth ActionController::AbstractRequest::parse_request_parameters expects the value of each element of the "params" parameter to be an Array?
Cheers, T Thomas Lee wrote: > http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1142-simplified-parameter-parsing-codehttp://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1142-simplified-parameter-parsing-code > > Based on the prototype plugin, form_collections.git: > > http://www.vector-seven.com/git/rails/plugins/form_collections.git/ > > Copying the description from the ticket: > > ------------------ > > * This patch was written with the intent of simplifying the > implementation of UrlEncodedPairParser, as well as making its > behaviour somewhat more predictable/logical. > * Changes to semantics are minimal: only breaks seven actionpack > unit tests which are either testing broken inputs or strange > behaviour in the old parser. > * Of those seven unit tests, five can be made to pass with some > minimal changes to the parser. > * New semantics would make nested forms and/or manipulation of > collections in forms much easier to deal with. > > ------------------------------------------------------------------------ > > The semantic changes are as follows: > > INPUT: "a[][x]=5&a[][y]=10" > OLD PARSER OUTPUT: {"a" => [{"x" => "5", "y" => "10"}]} > NEW PARSER OUTPUT: {"a" => [{"x" => "5"}, {"y" => "10"}]} > > INPUT: "a[0][x]=5&a[0][y]=10" > OLD PARSER OUTPUT: {"a" => {"0" => {"x" => "5", "y" => "10"}}} > NEW PARSER OUTPUT: {"a" => [{"x" => "5"}, {"y" => "10"}]} > > INPUT: "a[0][x]=5&a[1][y]=10" > OLD PARSER OUTPUT: {"a" => {"0" => {"x" => "5"}, "1" => {"y" => "10"}}} > NEW PARSER OUTPUT: {"a" => [{"x" => "5"}, {"y" => "10"}]} > > > ------------------------------------------------------------------------ > > Issues to be resolved: > > 1. Should the parser be modified to pass the old tests for invalid > inputs? > 2. "a[0]=1&a[999]=2" currently yields a 1000 element array with 998 > nil values. Should we implement a SparseArray class that minimizes > memory usage for such a situation, or force sequential indexes? > > ----------------- > > Would appreciate any feedback and/or recommendations. > > Cheers, > Tom > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
