Yes that is the question :D i have used include but is not a good option for me.. it includes the model (object) in the child of the xml file like this <objects> <otherobject> <shout></shout> </otherobject> </objects>
I managed now to get an array of the shouts and photos like this @objects = [...@place.shouts, @place.photos] and i get the objects in the xml file but the xml is like this now: <array type="array"> -<array type="array"> --<array> <body>.. THIS IS PHOTO --</array> -<array type="array"> --<array> <body>.. SHOUT --</array> so i get first the shouts and then the photos and this again in an array.. not how i wanted.. and it has to be sorted on date and not first the photos and then the shouts.. Any idea how to solve that? Wouter On 14 aug, 18:38, Colin Law <clan...@googlemail.com> wrote: > 2009/8/14 Wouter <wouterg...@gmail.com>: > > >[snip] > > But this will make 2 seperate arrays or am i wrong.. > > i want to have place.shouts and place.photos in the same array.. > > so like @objects = place.photos and place.shouts (but that don't work > > off course) > > and then i do @objects.to_xml > > > How can i do this? > > Is that the real question then? It was not clear to me. > > I have not used to_xml, but a glance at the docs > athttp://api.rubyonrails.org/classes/ActiveRecord/XmlSerialization.html > suggests that associated models can be included by using :include, or > have you not managed to get that to work? > > Colin --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---