aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2016-01-24 22:03:00 +0530
committerVipul A M <vipulnsward@gmail.com>2016-01-24 22:25:12 +0530
commitb334bc93c6c3a37f69de9a130d43b8f1fda67e3c (patch)
tree5ac6d8d0e0adc6bd341298fb403f95c3e4ce1531 /activerecord/test/cases
parent83d2c39d5eb8d82ba124b6725d08c8e90760c764 (diff)
downloadrails-b334bc93c6c3a37f69de9a130d43b8f1fda67e3c.tar.gz
rails-b334bc93c6c3a37f69de9a130d43b8f1fda67e3c.tar.bz2
rails-b334bc93c6c3a37f69de9a130d43b8f1fda67e3c.zip
Add missing source_type if provided on hmt which belongs to an sti record
Fixes #23209
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/reflection_test.rb9
1 files changed, 9 insertions, 0 deletions
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!