I see Jeremy Kemper commited a fix for this not too long after the post:
r5167 | bitsweat | 2006-09-22 17:29:54 -0400 (Fri, 22 Sep 2006) | 1 line
workaround collections loaded as :people => { :person => [{..attrs..},
{..attrs..}] }
Thank you!
-B
On 9/22/06, Bosko Milekic
<bosko.milekic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> ActiveResource uses xml_simple from activesupport to turn XML to
> essentially a big Hash or Array, after which point
> ActiveResource::Base''s load() (actually
find_or_create_resource_for,
> called from load) takes care of the remaining magic of building
> ActiveResource::Base instances to encapsulate the parsed XML data.
>
> Currently, if you have some XML that looks roughly like this:
>
> <my-model>
> <id type="integer">1</id>
> <some_attrib>blah blah</some_attrib>
> ...
> <related-entities>
> <related-entity>
> ...
> </related-entity>
> ...
> </related-entities>
> </my-model>
>
> What happens is that you get an AR instance for my_model, in which you
> have an attribute called "related_entities" which is a Hash, and
which
> contains a single attribute called "related_entity" which is an
Array.
> This makes sense given xml_simple''s parse/collapse/merge
trickery,
> but seems counter-intuitive for ActiveResource. I''d rather expect
to
> have an AR instance for my_model, with a "related_entities"
attribute
> which is itself immediately an Array of related_entity AR children.
>
> Make sense?
>
> --
> Bosko Milekic <bosko.milekic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> http://www.crowdedweb.com/
>
--
Bosko Milekic <bosko.milekic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
http://www.crowdedweb.com/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---