aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-14 12:17:40 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-14 12:17:40 -0300
commit25649c7fd74219881342b2cb59f97c08f646a4ea (patch)
treec115a57a3aab8c354ca58764416990131d61dd6c /activerecord/test
parentc05f9558eebf88a137d606c27f3e0be232e35100 (diff)
parent04e3b41e2fc834c842ef50f25feea829aab0bbbc (diff)
downloadrails-25649c7fd74219881342b2cb59f97c08f646a4ea.tar.gz
rails-25649c7fd74219881342b2cb59f97c08f646a4ea.tar.bz2
rails-25649c7fd74219881342b2cb59f97c08f646a4ea.zip
Merge pull request #9499 from dmitry/inverse_instance_should_not_be_reloaded_after_stale_state_change
Inversed instance should not be reloaded after stale state was changed Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test')
-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