Displaying my friends' friends in self-referential habtm

Hi guys,

I have a self-referential model of friends (based on Josh S.'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

This could help:
http://blog.hasmanythrough.com/2006/4/21/self-referential-through

helped me, anyway.

Elise

On May 21, 3:45 pm, Pepa R. [email protected]

[email protected] wrote:

This could help:
has_many :through - Self-referential has_many :through associations

helped me, anyway.

Elise

On May 21, 3:45 pm, Pepa R. [email protected]

Elisem, thank you.

actually I managed to implement the model, a variation on another Josh
Susser’s guidance at
has_many :through - Self-referential has_many :through associations.

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