As long as the array/object has not been touched by the prototype code (and thus would add properties to the object), the below should put you on the right track. I'm assuming you meant associative arrays as in "_javascript_ treats all objects as associative arrays" and not the Array type object (which in that case you'd just use a prototype .each() iterator to do this)...

var obj = {firstKey: firstVal, secondKey: secondVal};
var objStr = '';
for (var p in obj)
{
objStr = objStr + p + ":" + obj[p] + "|";
}

// ...now strip the last "|" symbol and you have your object as a string delimited by : for name/value pairs and | between the sets of values.

prototype's .flatten() might help also but I haven't used it too much.

On 4/28/06, SPENDLOVE, Matt, GBM <[EMAIL PROTECTED]> wrote:
Perhaps I missed something but I don't see an easy way to do this ?

Basically just wanna hold some ui state in a cookie.

Did I miss something obvious ?

Best

Matt

***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorized and regulated by the Financial Services Authority

This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The Royal
Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our websites at:
http://www.rbos.com
http://www.rbsmarkets.com
***********************************************************************************
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to