Topic: What's the best model structure for a freinship relationship

I want to implement the friendship model for my application. friendship among users could be one-way (one user add another as a friend) or mutual (both of them add each other)
what do you think is the best practice for making such models in rail. how should I structure my database tables (rails models)?

Re: What's the best model structure for a freinship relationship

You could have a join model with an additional boolean column that indicates if the friendship was accepted.

Person
-------
id
name

Friendship
--------
id
person_id
initiator_id
accepted

Where initiator_id would be the person who created the friendship, person_id is who they said their friend was, and 'accepted' was true or false depending on whether the person identified by person_id agreed that the friendship was mutual.

Re: What's the best model structure for a freinship relationship

Thanks a lot. that works like a charm.