diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2017-11-29 10:38:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-29 10:38:27 -0500 |
commit | 527ad1a32c2baf2a78c73104ac8aa52b39514f1f (patch) | |
tree | 2f5030f6947836b4000d2f254010c140920d9956 /activerecord/test/cases | |
parent | 5211c0dd8cc84d9458713ca55a4a8afe12f7df40 (diff) | |
parent | c10152daf948b5bdcf48cda06b9bbddee9e8c398 (diff) | |
download | rails-527ad1a32c2baf2a78c73104ac8aa52b39514f1f.tar.gz rails-527ad1a32c2baf2a78c73104ac8aa52b39514f1f.tar.bz2 rails-527ad1a32c2baf2a78c73104ac8aa52b39514f1f.zip |
Merge pull request #31214 from chopraanmol1/bug_fix_has_one_inverse_owner_reload_from_validation
Inverse instance should not be reloaded during autosave if called in validation
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/inverse_associations_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index f8f6b10e2b..c0d328ca8a 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -675,6 +675,16 @@ class InversePolymorphicBelongsToTests < ActiveRecord::TestCase assert_equal old_inversed_man.object_id, new_inversed_man.object_id end + def test_inversed_instance_should_not_be_reloaded_after_stale_state_changed_with_validation + face = Face.new man: Man.new + + old_inversed_man = face.man + face.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 |