To_xml depth

hello,

The “render :xml => myFriends.to_xml”, return something like:

2 ...

But a Person has a “has_many” relationship and they are not in the xml,
=> so is it possible to change the depth of the marshall process ?
if it not possible, what are the “rails guideline ;-)” …

thanks

arnaud

There are many Rails hosts listed on the RoR site. My question:

I need a host that provides support for both development and
production rails sites.

Can anyone recommend a US based host that supports development and
production hosting ? I want to use Capistrano, however capistrano
seems to restart Apache when it syncs your dev site with your remote
server. I can’t imagine too many hosting companies like that sort of
thing.

J-C

Arnaud G. wrote:

But a Person has a “has_many” relationship and they are not in the xml,
=> so is it possible to change the depth of the marshall process ?
if it not possible, what are the “rails guideline ;-)” …

See the :include option. In 1.1.2, it currently only supports a depth
of 1
association, but a patch I recently submitted and was accepted now
allows
arbitrary depth of :include.

Regards,
Blair


Blair Z., Ph.D.
[email protected]
Subversion training, consulting and support
http://www.orcaware.com/svn/

thanks Blair,
it is the good direction but …
My relation is Person has many infogroup and infogroup has many
infoattribute
Person—>*Infogroupe---->*Infoattribute

so, aPerson.to_xml :include => [:infogroups] works well now … but how
to go one more step deeper …
because, aPerson.to_xml :include => [:infogroups, :infoattributes ]
failed !
I saw something interesting with google;-), like aPerson.to_xml
:include => [{:infogroups => infoattributes}] does not work

many thanks for help
Arnaud

Blair Z. a écrit :

Arnaud G. wrote:

thanks Blair,
it is the good direction but …
My relation is Person has many infogroup and infogroup has many
infoattribute
Person—>*Infogroupe---->*Infoattribute

so, aPerson.to_xml :include => [:infogroups] works well now … but how
to go one more step deeper …

As I said in my previous note, in 1.1.2, it currently only supports a
depth of 1
association, so it won’t do what your looking for. The next release of
Rails
contains a patch that removes this limitation.

Regards,
Blair


Blair Z., Ph.D.
[email protected]
Subversion training, consulting and support
http://www.orcaware.com/svn/

yes rxml with the builder is also a solution, but it was more for
curiosity :wink:
thanks
arnaud

Rick O. a écrit :

I saw something interesting with google;-), like aPerson.to_xml
:include => [{:infogroups => infoattributes}] does not work

many thanks for help
Arnaud

There’s always rxml.