You could look for a Gem that handles Friendship. There are a few.
You could use and ORM called datamapper
On Mon, May 18, 2009 at 4:31 PM, Abm Abm
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:
>
> In my scenario, I have two tables namely; contacts and contacts_users.
> Table contacts consists of a primary key namely id and contacts_users
> has fields; id, contact_id, peer_id and status.
>
> contacts_users is basically the recursive relation of a contact to its
> peers, which he/she invited and vice versa. In other words, in one case,
> the id of a person lies in the contact_id field of contacts_users and in
> other case the id of same person lies in peer_id field. Moreover,
> peer_id and contact_id of contacts_users constitute a composite key. So,
> in contacts_users model i defined the said scenario like;
> validate_uniqueness_of :contact_id, :scope=>peer_id
> Which means; if A adds B, then A is a contact of B and B is a contact of
> A as well, and the relation cannot be replicated.
>
> Now what could be the relation of contacts_users and contacts tables, so
> that I could do contacts.contacts_users and get all the contacts of
> person A rather doing ContactsUsers.find_by_contact_id_or_peer_id?
>
> Please 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
-~----------~----~----~----~------~----~------~--~---