controllers: refactor only param includes.
Add extra includes needed by the `only` param inside `respond_with`.
This commit is contained in:
@@ -3,7 +3,9 @@ class WikiPageVersionsController < ApplicationController
|
||||
layout "sidebar"
|
||||
|
||||
def index
|
||||
@wiki_page_versions = WikiPageVersion.paginated_search(params).includes(model_includes(params))
|
||||
@wiki_page_versions = WikiPageVersion.paginated_search(params)
|
||||
@wiki_page_versions = @wiki_page_versions.includes(:updater) if request.format.html?
|
||||
|
||||
respond_with(@wiki_page_versions)
|
||||
end
|
||||
|
||||
@@ -27,14 +29,4 @@ class WikiPageVersionsController < ApplicationController
|
||||
|
||||
respond_with([@thispage, @otherpage])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def default_includes(params)
|
||||
if ["json", "xml"].include?(params[:format])
|
||||
[]
|
||||
else
|
||||
[:updater]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user