Dirk Breuer
2006-Jan-05 13:55 UTC
[Rails] 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 Root: id: 1 name: root Left_Node: id: 2 name: left_node parent_id: 1 Right_Node: id: 3 name: right_node parent_id: 1 -- Posted via http://www.ruby-forum.com/.
Tom Mornini
2006-Jan-05 14:01 UTC
[Rails] Fixture files for inserting tree like behavior doesn''t work
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 Mornini On Jan 5, 2006, at 8:54 AM, Dirk Breuer wrote:> 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 > Root: > id: 1 > name: root > Left_Node: > id: 2 > name: left_node > parent_id: 1 > Right_Node: > id: 3 > name: right_node > parent_id: 1 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails