Topic: can one fixture refer to another fixture

So if I have a model called Parent and another called Child, where Child belongs_to Parent through a foreign key called parent_id, can I assign a Child to a Parent in the YAML file?

So something like:

fixtures/parents.yml:

john:
  id: 1

fixtures/children.yml:
johns_son:
  id: 1
  parent_id: parents(:john).id

Re: can one fixture refer to another fixture

This isn't possible.  What's the best way around this?

Re: can one fixture refer to another fixture

Does anyone have the answer to this? Thanks!

Re: can one fixture refer to another fixture

Yea, you just do it like this

john:

johns_son:
parent: john

Look up foxy fixtures.

http://danielfischer.com - Personal Web-Technology-Blog, Los Angeles.