Fixture files for inserting tree like behavior doesn't work

Hi folks around, hope you could help me with my problem.

I have a porblem while testing my Acts_as_Tree behavior with fixtures.
Because all data in the fixture file will be commited at the end the
entries I want to map my tree like structure to will not be present at
this point. Due to this I get a foreign key constraints fails from the
database. Is there any way to solve this problem?

Here is a short example of the problem:

Fixture file for testing Acts_as_Tree behavior

id: 1
name: root
id: 2
name: left_node
parent_id: 1
id: 3
name: right_node
parent_id: 1

It has nothing to do with when the commit happens.

It has everything to do with the fact that they’re
loaded in alphabetical order.

– Tom M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs