Forum: Ruby on Rails relations between contact_person and contact_business

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Trom T. (Guest)
on 2009-05-07 21:11
Hello all,

i am stuck with something.

i have the following situation:

           |         (either one of booth; business or contact)
i have a contacts model that either extends to contact_business or
contact_person, depending if its a person or a business.
now i whant to describe relationships between people and businesses.
i thought about something like this:
           |         (either one of booth; business or contact)
           |--|0-n|--contact_relations (contact_person_contact_id,
so contact_relations would store the contact_id of the file that is
create/edited depending if it is a business or a person in
contact_business_contact_id or contact_person_contact_id and the
contact_id of the relation (wich must be the other kind) in the other
this would be the way i would do it by hand, if i would have programmed
this in php. but in ror i dont really know or understand how this is t
be accomplished.

maybe self joins is the solution
( but
somehow i dont understand how this works and what table collums i would

can somebody help me?

thanks a lot,

This topic is locked and can not be replied to.