You could use STI to make Person and Group the same table.

You could use a custom method and an extra field describing the type
and then making the appropriate calls based on the type.

That's all I got.

Interesting problem.

Is this something a polymorphic has 1 could solve?



On Sep 29, 4:40 pm, Kless <[EMAIL PROTECTED]> wrote:
> If you have a table that is belonged to several another tables, which
> would be the best way to create it? Having in mind that it only can be
> belonged to one table at the same time.
>
> Is this correct?
> -------------------
> class Email
>    property :id, Serial
>    belongs_to :person
>    belongs_to :group
> end
>
> class Person
>    property :id, Serial
>    has n :emails
> end
>
> class Group
>    property :id, Serial
>    has n :emails
> end
> -------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to