From 131ed24f5ef41f5470e83fb66cfff61f635bf24d Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 30 Jun 2017 02:29:52 +0900 Subject: Should be clear `@association_ids` when joined newly associated record Fixes #29627. --- activerecord/test/cases/associations/has_many_associations_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index a936017ae3..d7515a4c18 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -2544,6 +2544,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal [bulb.id], car.bulb_ids assert_no_queries { car.bulb_ids } + + bulb2 = car.bulbs.create! + + assert_equal [bulb.id, bulb2.id], car.bulb_ids + assert_no_queries { car.bulb_ids } end def test_loading_association_in_validate_callback_doesnt_affect_persistence -- cgit v1.2.3