Am 16.05.2010 um 16:03 schrieb Ozgur Yılmaz:

Hi everybody,

I'm very new to elixir and I have a question, here we go: I'm creating an Entity which will be an abstract class for the others and it has two OneToOne relations to the same class. The code is something like that:

class Base(Entity):
    using_options( abstract=True )
    created_by = OneToOne( 'User', inverse='?????' )
    updated_by = OneToOne( 'User', inverse='?????' )

class User( Base ):
    pass

class Note( Base ):
    pass

if I was not using a base class, than for User I was going to write inverse='Users_created' and inverse='Users_updated' and for the notes I was going to create inverse='Notes_created' and inverse='Notes_Updated', so what should I write for the inverse parameter, so that both the User and Note classes has a correct references to the inverse tables.

Nothing. Just subclass & write normal declarations into the subclasses.

If you insist, you can put code into the module that traverses the subclasses of Base and makes sure they do that (metaclasses are off- limits, at least simple ones, as elixir uses them)

Diez

--
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