[Rails] Ordering Fixtures

Rath --- rathjunk at gmail.com
Wed Aug 9 07:48:16 GMT 2006


I'm trying to extract_fixtures using the example from the Recipes book 
but I want to extract them in order (by id) Does anyone know how to do 
that?

data = sorted_array_of_objects_by_id
file.write data.inject({}) { |hash, record|
  hash["#{table_name}_#{i.succ!}"] = record
  hash
}.to_yaml

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list