aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorDmitry Polushkin <dmitry.polushkin@gmail.com>2013-03-01 01:08:27 +0000
committerDmitry Polushkin <dmitry.polushkin@gmail.com>2013-10-13 21:51:40 +0100
commit05b178085a2ad3bf3f2c0dcd1ea40fb5e8c8dc0d (patch)
treec4d2fb44cff900cd92fe912756b435b8c9d17436 /activerecord/test/cases/associations
parentdcff027a5242b20c0c90eb062dddb22ccf51aed9 (diff)
downloadrails-05b178085a2ad3bf3f2c0dcd1ea40fb5e8c8dc0d.tar.gz
rails-05b178085a2ad3bf3f2c0dcd1ea40fb5e8c8dc0d.tar.bz2
rails-05b178085a2ad3bf3f2c0dcd1ea40fb5e8c8dc0d.zip
inversed instance should not be reloaded after stale state was changed
check at association reader that record is inverted and should not be reloaded because of stale was changed at target record
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/inverse_associations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb
index 8c81e00865..893030345f 100644
--- a/activerecord/test/cases/associations/inverse_associations_test.rb
+++ b/activerecord/test/cases/associations/inverse_associations_test.rb
@@ -603,6 +603,18 @@ class InversePolymorphicBelongsToTests < ActiveRecord::TestCase
assert_equal face.description, new_man.polymorphic_face.description, "Description of face should be the same after changes to replaced-parent-owned instance"
end
+ def test_inversed_instance_should_not_be_reloaded_after_stale_state_changed
+ new_man = Man.new
+ face = Face.new
+ new_man.face = face
+
+ old_inversed_man = face.man
+ new_man.save!
+ new_inversed_man = face.man
+
+ assert_equal old_inversed_man.object_id, new_inversed_man.object_id
+ end
+
def test_should_not_try_to_set_inverse_instances_when_the_inverse_is_a_has_many
i = interests(:llama_wrangling)
m = i.polymorphic_man