Hey Guys

Re: Nested hashes/arrays of hashes

I know Colin was talking about this some time back but I just wanted to
clarify whether these actually work...
I had a scenario where I wanted to return effectively an array of hashes
(though nested hashes would be better) for metadata about form fields (to
implement a cascading requirement)

eg:
Client sends "Field 1 changed to 2"
Server replies with {fieldid:'fielda',properties:{required:true,label:'Field
A'}},{fieldid:'fieldb',properties:{required:true,label:'Field B'}} (which in
this case might be dependent on the fact that field1 has changed to 2,
rather than 3 or 4)
Client receives reply and loads the data and iterates through the received
meta setting the various properties as appropriate.

However, I wasn't sure what the format of the reply should be in order to
implement such functionality.
It doesn't need the nested hashes but I do need to return an array of
hashes.
I think I returned a 1 dimensional ~ seperated array and then split it to
iterate but I'm sure there's a better way.

Could someone give me an example of the reply and the method to get it into
a hash, if not just $H(transport.responseText)
I tried the $H method as well as the toJSON (or is it fromJSON, i cant
remember)

Gareth

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to