controllers: refactor only param includes.
Add extra includes needed by the `only` param inside `respond_with`.
This commit is contained in:
@@ -17,7 +17,8 @@ class PoolsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@pools = Pool.paginated_search(params, count_pages: true).includes(model_includes(params))
|
||||
@pools = Pool.paginated_search(params, count_pages: true)
|
||||
@pools = @pools.includes(:creator) if request.format.html?
|
||||
|
||||
respond_with(@pools)
|
||||
end
|
||||
@@ -90,10 +91,6 @@ class PoolsController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def default_includes(params)
|
||||
[:creator]
|
||||
end
|
||||
|
||||
def item_matches_params(pool)
|
||||
if params[:search][:name_matches]
|
||||
Pool.normalize_name_for_search(pool.name) == Pool.normalize_name_for_search(params[:search][:name_matches])
|
||||
|
||||
Reference in New Issue
Block a user