On 4/9/07, isaac <[EMAIL PROTECTED]> wrote:

> What would be the appropriate syntax to add?
>
> Perhaps:
>
>       has_many('twos', of_kind='ThingTwo', inverse='ones',
>                proxy_class='Cat' proxy_through='two',
>                proxy_name='cats', order_by=Cats.c.sorter)
>
> Or maybe less complex, but requiring a matching has_many('cats'...):
>
>       has_association('twos', relation='cats', proxy_via='two')
>
> ... something like that?

What I had envisioned is kind of a mix of both: to be able to reuse an
explicit relation, like you do in the has_association case, but also
have a "shortcut" syntax for when you don't want to/don't care about
the relation to the intermediary table, something like:

    has_association('twos', of_kind='ThingTwo', secondary='Cat')

this would automatically create a relation to Cat behind the scene.


I'm also wondering if it wouldn't make more sense to reuse the
has_and_belongs_to_many statement instead of making a new
has_association statement. The reasoning is that one ThingOne object
can be related to many ThingTwo and vice versa, and this kind of
relationship is described by an has_and_belongs_to_many relationship,
so I think it's more consistent to use that term.

    has_many('cats', of_kind='Cat')
    has_and_belongs_to_many('twos', of_kind='ThingTwo',
through='cats', via='two')

in that case, the of_kind would be optional though (but if it's
present we could check that we are indeed pointing to what we want),
so we could see some relationships defined like this:

    has_many('cats', of_kind='Cat')
    has_and_belongs_to_many('twos', through='cats', via='two')

-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to