aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-09-27 16:56:49 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-09-27 16:56:49 -0700
commit3e0a60e4e2316ee696bdcf1c115582f8f450ad07 (patch)
tree9cfa220e983dd7baa633b65704becf1ebfa34a52 /activerecord/test/cases
parentf399538f99f9ae3311b694d7e579104ec98b899d (diff)
downloadrails-3e0a60e4e2316ee696bdcf1c115582f8f450ad07.tar.gz
rails-3e0a60e4e2316ee696bdcf1c115582f8f450ad07.tar.bz2
rails-3e0a60e4e2316ee696bdcf1c115582f8f450ad07.zip
adding a test to demonstrate how to use STI subclasses on the far right
side of a hm:t association along with preloading.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index c0e80c5fe9..5299e4e17e 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -37,6 +37,13 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
Reader.create :person_id => 0, :post_id => 0
end
+ def test_preload_sti_rhs_class
+ developers = Developer.includes(:firms).all.to_a
+ assert_no_queries do
+ developers.each { |d| d.firms }
+ end
+ end
+
def test_preload_sti_middle_relation
club = Club.create!(name: 'Aaron cool banana club')
member1 = Member.create!(name: 'Aaron')