# File lib/ar_fixtures.rb, line 49 def to_fixture(limit=nil) opts = {} opts[:limit] = limit if limit write_file(File.expand_path("test/fixtures/#{table_name}.yml", RAILS_ROOT), self.find(:all, opts).inject({}) { |hsh, record| hsh.merge("#{table_name.singularize}_#{'%05i' % record.id}" => record.attributes) }.to_yaml(:SortKeys => true)) habtm_to_fixture end