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:
@@ -39,7 +39,7 @@ class PoolsController < ApplicationController
|
||||
|
||||
def show
|
||||
@pool = Pool.find(params[:id])
|
||||
@post_set = PostSets::Pool.new(@pool, params[:page])
|
||||
@posts = @pool.posts.paginate(params[:page], limit: params[:limit], count: @pool.post_count)
|
||||
respond_with(@pool)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user