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 ArtistUrlsController < ApplicationController
|
||||
before_action :member_only, except: [:index]
|
||||
|
||||
def index
|
||||
@artist_urls = ArtistUrl.paginated_search(params).includes(model_includes(params))
|
||||
@artist_urls = ArtistUrl.paginated_search(params)
|
||||
@artist_urls = @artist_urls.includes(:artist) if request.format.html?
|
||||
|
||||
respond_with(@artist_urls)
|
||||
end
|
||||
|
||||
@@ -15,14 +17,6 @@ class ArtistUrlsController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def default_includes(params)
|
||||
if ["json", "xml"].include?(params[:format])
|
||||
[]
|
||||
else
|
||||
[:artist]
|
||||
end
|
||||
end
|
||||
|
||||
def artist_url_params
|
||||
permitted_params = %i[is_active]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user