From b334bc93c6c3a37f69de9a130d43b8f1fda67e3c Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Sun, 24 Jan 2016 22:03:00 +0530 Subject: Add missing source_type if provided on hmt which belongs to an sti record Fixes #23209 --- activerecord/test/cases/reflection_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 9c04a41e69..a130d9f7ca 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -23,6 +23,7 @@ require 'models/chef' require 'models/department' require 'models/cake_designer' require 'models/drink_designer' +require 'models/mocktail_designer' require 'models/recipe' class ReflectionTest < ActiveRecord::TestCase @@ -278,6 +279,14 @@ class ReflectionTest < ActiveRecord::TestCase assert_equal 2, @hotel.chefs.size end + def test_scope_chain_does_not_interfere_with_hmt_with_polymorphic_case_and_sti + @hotel = Hotel.create! + @hotel.mocktail_designers << MocktailDesigner.create! + + assert_equal 1, @hotel.mocktail_designers.size + assert_equal 1, @hotel.chef_lists.size + end + def test_scope_chain_of_polymorphic_association_does_not_leak_into_other_hmt_associations hotel = Hotel.create! department = hotel.departments.create! -- cgit v1.2.3