On 10/3/05, Peter Fitzgibbons
<peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello all,
> I''m using 0.13.1 agains SQL 2000.
> I have two tables linked by FK, both PKs are Identity(1,1) fields.
>
> Company -> Project
>
> So, I''m trying to fixture the two tables, but table "B"
gives me :
>
>
>
> ActiveRecord::StatementInvalid: Execute
>
> OLE error code:80040E2F in Microsoft OLE DB Provider for SQL Server
>
> INSERT statement conflicted with COLUMN FOREIGN KEY constraint
> ''PROJECT_COMPANY_FK''. The conflict occurred in database
> ''HOMEBUILDER_RAILS_TEST'', table
''Company'', column ''CompanyID''.
>
> HRESULT error code:0x80020009
>
> Exception occurred.: INSERT INTO project [... snip ...])
>
>
>
> Do you have an idea how to overcome the identities with fixtures ?
Can you post your fixtures and your table definitions?
I ran into this when I assumed that the fixtures would take care of
populating the id fields without my specifying the exact id.
Also check the order you are calling the fixture method at the top of
the test file.
Ken