aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-10-13 19:06:15 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-10-13 19:06:15 +0000
commit88c3416ffd0d6777bd38725274f2641a9e57dd00 (patch)
tree3ea306225239333c2dc010e539a3e7ad2fd5fef9 /activerecord/lib
parenta04d80b7533a56cb123d1d442137da7facb94a77 (diff)
downloadrails-88c3416ffd0d6777bd38725274f2641a9e57dd00.tar.gz
rails-88c3416ffd0d6777bd38725274f2641a9e57dd00.tar.bz2
rails-88c3416ffd0d6777bd38725274f2641a9e57dd00.zip
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
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb8
1 files changed, 7 insertions, 1 deletions
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)