2009/8/14 Wouter <wouterg...@gmail.com>: > > Thank you for your answer! > >> @shouts = Shout.find(:all, :include => [:place, :profile]) >> @photos = Photo.find(:all, :include => [:place, :profile]) > > But with this i got 2 arrays and I need 1 array with all the photos > and shouts in it.. > and if i do @objects = [...@shouts, @photos] and then @objects.to_xml, I > get the same as a few posts above: > > <?xml version="1.0" encoding="UTF-8"?> > <arrays type="array"> > <array type="array"> > <array> > <body>Ahaaa</body> > <created_at type="datetime">2009-08-14T15:56:40Z</created_at> > <id type="integer">71</id> > <place_id type="integer">51</place_id> > > <profile_id type="integer">1</profile_id> > </array> > </array> > <array type="array"> > <array> > <caption></caption> > <created_at type="datetime">2009-08-14T17:14:55Z</created_at> > <geo_lat type="float">50.7727</geo_lat> > > <geo_long type="float">4.53766</geo_long> > <id type="integer">20</id> > <image>/Users/woutergo/Documents/workspace/myBuddyNetwork/public/ > system/photo/image/20/14njk8w.jpg</image> > <place_id type="integer">51</place_id> > <profile_id type="integer">1</profile_id> > <show_geo type="integer" nil="true"></show_geo> > > <updated_at type="datetime">2009-08-14T17:14:55Z</updated_at> > </array> > </array> > </arrays> > > There must be another way.. Thank you >
Have you tried providing some virtual members of your model that make that data accessible in the way that you want, then using to_xml and specifying only the virtual members to be used? I don't know if this will work but it is worth a try. 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 -~----------~----~----~----~------~----~------~--~---