hello,
The "render :xml => myFriends.to_xml", return something like:
<people>
<person>
<id type="integer">2</id>
...
<person>
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
Jean-Charles Carelli
2006-Jun-19 20:24 UTC
[Rails] hosting for development and production vs capistrano
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 Garcia wrote:> hello, > > The "render :xml => myFriends.to_xml", return something like: > > > <people> > <person> > <id type="integer">2</id> > ... > <person> > > > 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 Zajac, Ph.D. <blair@orcaware.com> 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 Zajac a ?crit :
> Arnaud Garcia wrote:
>
>> hello,
>>
>> The "render :xml => myFriends.to_xml", return something
like:
>>
>>
>> <people>
>> <person>
>> <id type="integer">2</id>
>> ...
>> <person>
>>
>>
>> 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
>
> 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 > ArnaudThere''s always rxml. -- Rick Olson http://techno-weenie.net
yes rxml with the builder is also a solution, but it was more for curiosity ;-) thanks arnaud Rick Olson a ?crit :>> 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 > > > There''s always rxml. >
Arnaud Garcia 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 Zajac, Ph.D. <blair@orcaware.com> Subversion training, consulting and support http://www.orcaware.com/svn/