Hello all,

i am stuck with something.

i have the following situation:

[code=]contacts---|
           |--|0-1|--contact_businesses
           |         (either one of booth; business or contact)
           |--|0-1|--contact_people[/code]
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:
[code=]contacts---|
           |--|0-1|--contact_businesses
           |         (either one of booth; business or contact)
           |--|0-1|--contact_people
           |
           |--|0-n|--contact_relations (contact_person_contact_id,
contact_business_contact_id)[/code]
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
field.
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
(http://guides.rubyonrails.org/association_basics.html#self-joins). but
somehow i dont understand how this works and what table collums i would
need.

can somebody help me?

thanks a lot,

togo123
-- 
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to