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:
1 blah blah ... ... ...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 M. [email protected]
http://www.crowdedweb.com/