post_tags_match: replace joins with subqueries.

Refactor various post_tag_match methods to use subqueries instead of joins.

This simplifies things inside PostQueryBuilder, since now we can assume
we're always dealing with a Post relation, rather than some other table
joined with the posts table.
This commit is contained in:
evazion
2018-12-11 18:10:20 -06:00
parent cacc899a4d
commit 37b2214472
10 changed files with 14 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ class Note < ApplicationRecord
end
def post_tags_match(query)
PostQueryBuilder.new(query).build(self.joins(:post)).reorder("")
where(post_id: PostQueryBuilder.new(query).build.reorder(""))
end
def for_creator(user_id)