Maintain foreign key linkages in fixtures

Is there anyway to refer to the entities being linked in a foreign key
field of
a fixture by name instead of id?

Ie, if I have
categories.yml
some_cat:
id: 1
name: Foo
other_cat:
id: 2
name: Bar

data.yml
some_item:
id: 1
category_id: <%= categories(:some_cat).id %>
name: Hello World

The above doesn’t work due to scope, even if the fixtures are loaded in
the
proper order. But I think it illustrates what I’d like to do. If the
objects
in my fixtures have “good” names, then I’d rather use them when defining
objects that use them – I can remember the names much better than I can
remember the arbitrary numbers.

I was able to get something of the form:
data.yml
some_item:
id: 1
category_id: <%= (Category.find_by_name “Foo”).id %>
name: Hello World

to work, but that’s adding an extra query to the overhead of
establishing the
fixture. I can probably take that hit on the small project I’m working
on now,
but on other projects it would probably force me to run smaller suites
than I’d
like.

Is there a better way?

Eric