Topic: Fixtures load order messes up foreign keys

It seems like the rake task for db:fixtures:load loads fixtures in alphanumeric order.  Is there a config file or a way to load fixtures in a specified order?

Because it's what code craves.

Re: Fixtures load order messes up foreign keys

No takers for this one?  It works fine for running the migrations, but it'd be nice to be able to specify the order of how fixtures are loaded.

Because it's what code craves.

Re: Fixtures load order messes up foreign keys

After trying different google queries, it turns out this is easy to fix.  Hopefully this helps someone else:

http://techpolesen.blogspot.com/2007/04 … -tips.html

The meat of it is to specify:

ENV['FIXTURES'] ||= 'dependent1,dep2,...,depN'

where the fixtures will be loaded from left to right.

Because it's what code craves.

Re: Fixtures load order messes up foreign keys

You can also disable foreign key check during the loading of fixtures:
http://wiki.rubyonrails.org/rails/pages … UnderMySql