From d665f91d412a29d7bd93db38b8fdbc07ed50c510 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 25 Sep 2012 13:20:26 -0700 Subject: Fix destructive side effects from marshaling an association caused by 65843e1acc0c8d285ff79f8c9c49d4d1215440be --- activerecord/test/cases/associations/extension_test.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/associations/extension_test.rb b/activerecord/test/cases/associations/extension_test.rb index bd5a426ca8..da767a2a7e 100644 --- a/activerecord/test/cases/associations/extension_test.rb +++ b/activerecord/test/cases/associations/extension_test.rb @@ -40,9 +40,12 @@ class AssociationsExtensionsTest < ActiveRecord::TestCase assert_equal projects(:action_controller), david.projects.find_most_recent marshalled = Marshal.dump(david) - david = Marshal.load(marshalled) - assert_equal projects(:action_controller), david.projects.find_most_recent + # Marshaling an association shouldn't make it unusable by wiping its reflection. + assert_not_nil david.association(:projects).reflection + + david_too = Marshal.load(marshalled) + assert_equal projects(:action_controller), david_too.projects.find_most_recent end def test_marshalling_named_extensions -- cgit v1.2.3