Fix N+1 queries problem in /explore/posts/popular.json.

This commit is contained in:
evazion
2021-12-09 22:53:22 -06:00
parent 514c57ce58
commit 4021ddb579

View File

@@ -51,11 +51,11 @@ module Explore
end
def popular_posts(min_date, max_date)
Post.where(created_at: min_date..max_date).user_tag_match("order:score")
Post.where(created_at: min_date..max_date).includes(:media_asset).user_tag_match("order:score")
end
def curated_posts(min_date, max_date)
Post.where(created_at: min_date..max_date).user_tag_match("order:curated")
Post.where(created_at: min_date..max_date).includes(:media_asset).user_tag_match("order:curated")
end
end
end