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 On 14 aug, 19:07, Alpha Blue <rails-mailing-l...@andreas-s.net> wrote: > Wouter wrote: > > Any idea how I can do that? How can i use that? > > @shouts = Shout.find(:all, :include => [:place, :profile]) > @photos = Photo.find(:all, :include => [:place, :profile]) > > You can also use a :joins in the model if you tie it all together > properly. This is just a very basic example. > > Test it out in the rails console then call the data back.. > > shouts = Shout.find(:all, :include => [:place, :profile]) > shouts.place > shouts.profile > etc... > > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---