From 88c3416ffd0d6777bd38725274f2641a9e57dd00 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 13 Oct 2005 19:06:15 +0000 Subject: r3581@sedna: jeremy | 2005-10-13 12:20:42 -0700 Preserve order of fixture declarations. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2560 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/fixtures.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 5a7ccc8384..11a53387f9 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -2,6 +2,12 @@ require 'erb' require 'yaml' require 'csv' +class YAML::Omap + def keys; map { |k, v| k } end + def values; map { |k, v| v } end +end + + # Fixtures are a way of organizing data that you want to test against; in short, sample data. They come in 3 flavours: # # 1. YAML fixtures @@ -191,7 +197,7 @@ require 'csv' # the results of your transaction until Active Record supports nested transactions or savepoints (in progress.) # 2. Your database does not support transactions. Every Active Record database supports transactions except MySQL MyISAM. # Use InnoDB, MaxDB, or NDB instead. -class Fixtures < Hash +class Fixtures < YAML::Omap DEFAULT_FILTER_RE = /\.ya?ml$/ def self.instantiate_fixtures(object, table_name, fixtures, load_instances=true) -- cgit v1.2.3