Re: Parameter Parsing with Duplicate Parameters

Jeremy Kemper
2006-08-24T06:06:04Z

On 8/23/06, MacProBob <bobtheslob@gmail.com>
wrote:
>
> Wondering if this should be the correct behavoir of parameter parsing
> in Rails.
>
> GET /controller/action?key=value1&key=value2
>
> puts params[''key'']  # = value1
>
> Currently, if you pass in multiple values with the same key, the FIRST
> value is the value that is used and available in params. I think this
> goes against PoLS in that keys defined later in html or on the query
> string should override any previously defined values for that key.
I''m
> not referring to the ability to create an array using the [] syntax.
>
> There is no written specification for how to parse incoming data, but
> it seems logical that you would want the values defined later to be the
> values you retrieve from your framework. (Most other web technologies
> follow this behavoir as well, PHP, Django, all the Java crap etc..)
>
> Opinions on this behavoir? I can do up a patch to enable it, not sure
> what BC effects this would cause since you can''t really rely on
this
> behavoir right now anyways.


Take a look at the checkbox form helper. It effectively exploits the current
behavior.

jeremy