aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-22 08:28:57 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-22 08:28:57 +0000
commitdc901ced448179d9dfec924e22d8444b1a75265c (patch)
tree3dcbcfa95d8a2feb142712d57d7dbad688596756
parentef6784f761546b9558d977ae2d2f8333737de829 (diff)
downloadrails-dc901ced448179d9dfec924e22d8444b1a75265c.tar.gz
rails-dc901ced448179d9dfec924e22d8444b1a75265c.tar.bz2
rails-dc901ced448179d9dfec924e22d8444b1a75265c.zip
Ruby 1.9 compat: Fixtures inherits Hash instead of YAML::Omap since it's now insertion-ordered. Work around a &:procname crash.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8480 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 7a00b5bb56..611365669d 100755
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -438,7 +438,7 @@ end
#
# Any fixture labeled "DEFAULTS" is safely ignored.
-class Fixtures < YAML::Omap
+class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash)
DEFAULT_FILTER_RE = /\.ya?ml$/
@@all_cached_fixtures = {}
@@ -467,7 +467,7 @@ class Fixtures < YAML::Omap
end
def self.cache_fixtures(connection, fixtures)
- cache_for_connection(connection).update(fixtures.index_by(&:table_name))
+ cache_for_connection(connection).update(fixtures.index_by { |f| f.table_name })
end
def self.instantiate_fixtures(object, table_name, fixtures, load_instances = true)