aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-31 01:20:21 -0500
committerGitHub <noreply@github.com>2017-01-31 01:20:21 -0500
commit505463c859927408665ce141426f098fea303a4e (patch)
tree831bf669ffd54ce5d9450bf4071152d14f2206f3 /activerecord/test
parent44901ca9039dcf512a706b06c77e11004e661666 (diff)
parente09da8bf7853f8f4f1ebb5c52f9b688a32b4dfaa (diff)
downloadrails-505463c859927408665ce141426f098fea303a4e.tar.gz
rails-505463c859927408665ce141426f098fea303a4e.tar.bz2
rails-505463c859927408665ce141426f098fea303a4e.zip
Merge pull request #27838 from kamipo/reload_destroyed_through_record
Reload `through_record` that has been destroyed in `create_through_record`
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_one_through_associations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb
index 432c3526a5..38a729d2d4 100644
--- a/activerecord/test/cases/associations/has_one_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb
@@ -86,6 +86,13 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase
assert_nil @member.club
end
+ def test_set_record_after_delete_association
+ @member.club = nil
+ @member.club = clubs(:moustache_club)
+ @member.reload
+ assert_equal clubs(:moustache_club), @member.club
+ end
+
def test_has_one_through_polymorphic
assert_equal clubs(:moustache_club), @member.sponsor_club
end