FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

HELP

 
Post new topic   Reply to topic    NetBeans Forums -> Ruby Users
View previous topic :: View next topic  
Author Message
johndavid



Joined: 08 Aug 2009
Posts: 1

PostPosted: Sat Aug 08, 2009 5:37 am    Post subject: HELP Reply with quote

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.

_________________
SEO services india
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Ruby Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB