I like the new fixture features for rails 2.1. However, I would like to define a mapper so I specify the IDs to be used, rather than a hash. This is for several simple reasons: For one, I can type the URLs out a lot easier if the ID is 12 vs 12351231. For two, I am maintaining will-be live data in fixtures, and when I flip the switch and make it actually live, I would rather not have to deal with new IDs starting in the millions.
So, I know I can do this with ERB:
<% @current_id = 1 def next_id @current_id += 1 end
<%= next_id %>: id: <%= map_name(:quicktiger) %> name: Quicktiger ...
The thing is, I will want to use this map_name function from many fixtures. However, I cannot seem to find the right place to put it so I can access it from all fixure files. Is there a fixture helper somewhere that I'm not aware of?
--Michael