[Dbix-class] Re: create_related is failing on second time through loop?

Tim Anderson tja824 at gmail.com
Thu Jun 21 20:41:47 GMT 2012


Thanks for the quick response Ben.

I am indeed setting a 'detail_id =3D> 5' 2 times, but 'against' 2 different
header records.   On loop 1, the primary key for the new detail record is
'header_id: 1, detail_id: 5' and on loop 2 it is 'header_id: 2, detail_id:
5'.  I probably wasn't clear enough in the last post that the detail table
has header_id and detail_id as primary keys.

It's not a referential integrity problem; the database isn't even getting
called on the second loop..  It seems like something is not being released
or undef'd before the second loop occurs, but I can't put my finger on it.


-Tim


On Thu, Jun 21, 2012 at 2:46 PM, Ben Tilly <btilly at gmail.com> wrote:

> You are inserting two different records with the same detail_id into a
> table named detail that likely has a primary key on detail_id.
>
> I suspect that in your test script you wanted to set header_id to 5,
> not detail_id.
>

<snip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120621/44b=
6f0fb/attachment.htm


More information about the DBIx-Class mailing list