pools/show: fix N+1 query on pool show page.

Fix a N+1 query when fetching posts to render thumbnails. Also adds
support for the `limit` url param on the posts show page.
This commit is contained in:
evazion
2019-08-08 23:12:40 -05:00
parent 6d171f44c4
commit 4f024d2360
4 changed files with 14 additions and 18 deletions

View File

@@ -15,9 +15,15 @@
<%= render "posts/partials/common/inline_blacklist" %>
<section>
<%= @post_set.presenter.post_previews_html(self) %>
<% if @pool.post_count == 0 %>
<%= render "post_sets/blank" %>
<% else %>
<% @posts.each do |post| %>
<%= PostPresenter.preview(post, pool_id: @pool.id) %>
<% end %>
<%= numbered_paginator(@post_set) %>
<%= numbered_paginator(@posts) %>
<% end %>
</section>
</div>
</div>