Mapping a ER model to Rails
Posted
by Thiago
on Stack Overflow
See other posts from Stack Overflow
or by Thiago
Published on 2010-04-13T17:51:32Z
Indexed on
2010/04/13
17:53 UTC
Read the original article
Hit count: 363
Hi there,
I want to map the following ER schema to rails: I have an entity called "user" which has a self relationship called "has friend", which has an attribute called "status". In code, I would like to run:
User.friends
and it should return me an array of users, containing the users that I'm friend of. It shouldn't matter in which side of the relationship I am (i.e. whether I'm the friender or the friendee). Any thoughts?
© Stack Overflow or respective owner