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:



this must be pretty easy, but I'm a newbie and failed to google it out.

This could help:

helped me, anyway.


Elisem, thank you.

actually I managed to implement the model, a variation on another Josh
Susser's guidance at

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