shouldn't composite foreign key => composite unique key work ?
with code and country being a key instead of id for author, dm still
generates the wrong sql
SELECT "id", "name", "type", "code", "country" FROM "books" WHERE
"type" = 'fiction' AND ("code" = '1' AND "country" = 'au') OR ("code"
= '2' AND "country" = 'au') ORDER BY "id"
starting to look like a bug
thanks
On Sep 7, 3:59 am, Martin Gamsjaeger <[email protected]> wrote:
> deepfryed,
>
> I'm quite sure that dm looks for matching model *keys* when you give
> :child_key and :parent_key options to relationship definitions. So if
> you want :child_key => [:code, :country] you need to make sure the
> both :code and :country are marked with :key => true. Also, :id,
> Serial, :key => true is not necessary, :id, Serial is enough. Serial
> properties are keys by default.
>
> HTH
> snusnu
>
> On Sun, Sep 6, 2009 at 15:21, deepfryed<[email protected]> wrote:
>
> >http://pastie.org/607656
>
> > the code generates the following SQL
>
> > SELECT "id", "name", "type", "code", "country" FROM "books" WHERE
> > "type" = 'fiction' AND ("code" = '1' AND "country" = 'au') OR ("code"
> > = '2' AND "country" = 'au') ORDER BY "id"
>
> > which is incorrect.
>
> > am I doing something incorrectly ?
>
> > i'm using dm-core/next
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---