diff options
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 6 | ||||
-rwxr-xr-x | activerecord/test/cases/fixtures_test.rb | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 8847865451..f5b2e73da9 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -561,7 +561,11 @@ class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash) now = now.to_s(:db) # allow a standard key to be used for doing defaults in YAML - delete(assoc("DEFAULTS")) + if is_a?(Hash) + delete('DEFAULTS') + else + delete(assoc('DEFAULTS')) + end # track any join tables we need to insert later habtm_fixtures = Hash.new do |h, habtm| diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 9e0d69310e..bedb26f28d 100755 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -565,7 +565,6 @@ class FoxyFixturesTest < ActiveRecord::TestCase assert(parrots(:louis).treasures.include?(treasures(:sapphire))) end - # FIXME: first assertion fails on Ruby 1.9 def test_strips_DEFAULTS_key assert_raise(StandardError) { parrots(:DEFAULTS) } |