aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-10-27 09:32:40 +0900
committerGitHub <noreply@github.com>2017-10-27 09:32:40 +0900
commit432b193d3a21540e29b9a2f381ac6d38ae2bfeb2 (patch)
treebe668eb8941890133f94a221c330316ee4c3d565 /activerecord/test/cases/associations
parent27265ee57c9420e233c877c7280cb8df53e31e0a (diff)
parenta8966cc4701dcdd982e291d63b27be736c777fc8 (diff)
downloadrails-432b193d3a21540e29b9a2f381ac6d38ae2bfeb2.tar.gz
rails-432b193d3a21540e29b9a2f381ac6d38ae2bfeb2.tar.bz2
rails-432b193d3a21540e29b9a2f381ac6d38ae2bfeb2.zip
Merge pull request #30682 from ahorek/fix_scope_for
delegate scope_for on PolymorphicReflection
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/nested_through_associations_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/nested_through_associations_test.rb b/activerecord/test/cases/associations/nested_through_associations_test.rb
index 3e37e512ca..ab3bf5eb8d 100644
--- a/activerecord/test/cases/associations/nested_through_associations_test.rb
+++ b/activerecord/test/cases/associations/nested_through_associations_test.rb
@@ -425,6 +425,11 @@ class NestedThroughAssociationsTest < ActiveRecord::TestCase
assert authors.empty?
end
+ def test_nested_has_many_through_with_scope_on_polymorphic_reflection
+ authors = Author.joins(:ordered_posts).where("posts.id" => posts(:misc_by_bob).id)
+ assert_equal [authors(:mary), authors(:bob)], authors.distinct.sort_by(&:id)
+ end
+
def test_has_many_through_with_foreign_key_option_on_through_reflection
assert_equal [posts(:welcome), posts(:authorless)], people(:david).agents_posts.order("posts.id")
assert_equal [authors(:david)], references(:david_unicyclist).agents_posts_authors