fix exception on polymorphic associations with predicates
This commit is contained in:
parent
afd4d8205e
commit
70fffaccfc
@ -8,7 +8,15 @@ def initialize(klass, table, association)
|
||||
def proxy_association
|
||||
@association
|
||||
end
|
||||
|
||||
def size
|
||||
@association.size
|
||||
end
|
||||
|
||||
def empty?
|
||||
@association.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def exec_queries
|
||||
|
@ -1197,7 +1197,15 @@ def test_deep_including_through_habtm
|
||||
author = Author.includes(:posts).references(:posts).reorder(:name).find_by('posts.title IS NOT NULL')
|
||||
assert_equal authors(:bob), author
|
||||
end
|
||||
|
||||
test "preloading with a polymorphic association and using the existential predicate but also using a select" do
|
||||
assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer
|
||||
|
||||
assert_nothing_raised do
|
||||
authors(:david).essays.includes(:writer).select(:name).any?
|
||||
end
|
||||
end
|
||||
|
||||
test "preloading with a polymorphic association and using the existential predicate" do
|
||||
assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user