Pepa Richter
2008-May-21 13:45 UTC
displaying my friends'' friends in self-referential habtm
Hi guys, I have a self-referential model of friends (based on Josh Susser''s tutorial), i.e. basically sthg like tables ''people'' and ''relationships''. What I want is to display my friends together with their friends (and possibly even deeper), some kind of tree i.e. the output should look like this: -myself --Bill ---Monica ---Hillary --Fidel ---Hugo --Hillary ---Bill ---Barrack etc. this must be pretty easy, but I''m a newbie and failed to google it out. thanks -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
huard.elise-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-May-21 14:24 UTC
Re: displaying my friends'' friends in self-referential habtm
This could help: http://blog.hasmanythrough.com/2006/4/21/self-referential-through helped me, anyway. Elise On May 21, 3:45 pm, Pepa Richter <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi guys, > > I have a self-referential model of friends (based on Josh Susser''s > tutorial), i.e. basically sthg like tables ''people'' and ''relationships''. > > What I want is to display my friends together with their friends (and > possibly even deeper), some kind of tree > > i.e. the output should look like this: > > -myself > --Bill > ---Monica > ---Hillary > --Fidel > ---Hugo > --Hillary > ---Bill > ---Barrack > > etc. > > this must be pretty easy, but I''m a newbie and failed to google it out. > thanks > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pepa Richter
2008-May-21 15:15 UTC
Re: displaying my friends'' friends in self-referential habtm
huard.elise-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> This could help: > http://blog.hasmanythrough.com/2006/4/21/self-referential-through > > helped me, anyway. > > Elise > > On May 21, 3:45 pm, Pepa Richter <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Elisem, thank you. actually I managed to implement the model, a variation on another Josh Susser''s guidance at http://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-through. If I use Josh''s example, I''d like to display a list of my ''preys'' together with their ''preys'' as well as their other ''predators'' and also my ''predators'' as well as their ''predators'' and their other ''preys''. I would be able to do that in SQL, but I''m a bit lost in the Rails naming conventions in this case... Thanks for any further help -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---