My opinion:
1. I support skipping nulls, as (depending on server implementation)
'foo=' may result in an empty string on the server rather than null.
Serialize empty strings.
2. Yes, although you could pursue numerical indexes (not my
preference), similar to how you handle hashes in #4, returning "foo[0]
=a&foo[2]=b"
3. No, flatten as a object with numerical keys, then address as per
#4. Provide the option for flatten as JSON instead; allow hooks for
other serialization formats to be added (such as PHP's serialize).
4. Yes.
TAG
On Mar 2, 2007, at 9:48 AM, Mislav Marohnić wrote:
> I'm combining Tobie's and mine Hash patches to see how they work
> out. These changes fix 3 bugs and remove some premature
> optimization from toQueryString method. Now, ticket #7494 by Skirch
> is about nested hash support - I like it and am thinking about
> rolling it in for the next release. There are a number of questions
> regarding all these changes, though. I'd like to sort out the
> inconsistencies.
> undefined (or null) values are currently serialized as empty
> strings - should those key/value pairs be skipped instead?
> undefined (or null) values are currently skipped if they're inside
> an array value - should it be consistent with #1?
> should array values be flattened when serializing? (#7494 does this)
> should we support nested hashes?
> Same questions expressed in JS code:
> { foo:null } => "foo="
> { foo:['a', null, 'b']} => "foo=a&foo=b"; { foo:[null] } => "foo="
> { foo:['a', ['b'], 'c']} => "foo=a&foo=[object]&foo=c"
> { foo:{bar:'baz'}} => "foo[bar]=baz"
> Remeber, the toQueryString is all about sending that data to the
> server. The result strings are also used inside Prototype to check
> if the form has been modified.
>
> Please, state your opinions.
>
> --
> http://dev.rubyonrails.org/ticket/7494
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---