From b2b559c75cf7c8f1dc6f22057b7780c72f45af51 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 26 Mar 2019 12:45:38 +0900 Subject: Fix CI failure due to remaining tagging records `TRUNCATE TABLE posts` also resets `AUTO_INCREMENT`. If newly created a post, it is wrongly associated with remaining tagging records. To un-associate remaining tagging record, use `post.create_tagging!` instead. Fixes #35751. --- .../test/cases/associations/eager_load_includes_full_sti_class_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb index 5fca972aee..673d5f1dcf 100644 --- a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +++ b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb @@ -21,7 +21,7 @@ module PolymorphicFullStiClassNamesSharedTest ActiveRecord::Base.store_full_sti_class = store_full_sti_class post = Namespaced::Post.create(title: "Great stuff", body: "This is not", author_id: 1) - @tagging = Tagging.create(taggable: post) + @tagging = post.create_tagging! end def teardown -- cgit v1.2.3