# To\_xml depth

**URL:** <https://www.ruby-forum.com/t/to-xml-depth/95923>\
**Category:** Rails\
**Created:** [June 19, 2006, 9:59pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923 "2006-06-19T21:59:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [June 19, 2006, 9:59pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/1 "2006-06-19T21:59:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [June 19, 2006, 10:29pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/2 "2006-06-19T22:29:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [June 19, 2006, 10:39pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/3 "2006-06-19T22:39:34Z")

</div>

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.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subversion training, consulting and support  
[http://www.orcaware.com/svn/](http://www.orcaware.com/svn/)

---

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [June 20, 2006, 7:29pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/4 "2006-06-20T19:29:48Z")

</div>

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 :

---

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [August 3, 2006, 2:24pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/5 "2006-08-03T14:24:04Z")

</div>

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.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subversion training, consulting and support  
[http://www.orcaware.com/svn/](http://www.orcaware.com/svn/)

---

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/6 "2006-08-15T14:21:41Z")

</div>

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

Rick O. a écrit :

---

<div class="post-metadata">

**Author:** ![Arnaud\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/46a35a/32.png) [@Arnaud\_G](https://www.ruby-forum.com/u/Arnaud_G)\
**Post date:** [August 3, 2006, 2:24pm UTC](https://www.ruby-forum.com/t/to-xml-depth/95923/7 "2006-08-03T14:24:05Z")

</div>

> 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.
