Foreign key on the same table testing

Hi @all

I wrote a rails app and now I want to test it.
For this, I’d like to use test fixtures wich I created in .yml-files.
In my model, each object can include another object. This
is done by a foreign key. Unfortunately, there is always an error
becaus of a
foreign key constraint which fails. Does anybody knows how to solve this
problem?
My .yml-file looks like this:
one:
id: 1
person_id: 1
father: null
person_type: parent
two:
id: 2
person_id: 2
father: 1
person_type: child

If I only insert the first one, it works…

Thanks for your help!

On Nov 13, 2:51 am, Pa Sc [email protected] wrote:

one:
If I only insert the first one, it works…

Thanks for your help!

Posted viahttp://www.ruby-forum.com/.

it isn’t clear if your’e doing single table inheritance (STI) or a
acts_as_nested_set (or acts_as_tree) structure, but these are both
well-established techniques with constraints on column names, if you
do a search for them