I have tried to use to_json to create an array that will be
manipulated in javascript on the client. The output of to_json looks
something like this:
[{addressable:
{attributes: {code: "123123123", quantity: "123", id:
"1",
description: "Window", unit_price: "12"}},
attributes: {addressable_type: "WorkshopOrderPart",
workshop_order_id: "1", addressable_id: "1", id:
"1", position:
"1"}},
{addressable: ...
}}]
You will notice that "attibutes" shows up twice due to the polymorphic
relationship but is not a range so if you assign it to a javascript
array then addressing it goes like this:
newarray[0].addressable.attributes.code
That works but:
newarray[0].addressable.attributes.addressable_type
does not. Anyone know how to go about addressing the "attributes"?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---