tests: fix regression in 6d867de20.
6d867de20 caused an exception in the ApiKeysController, which calls
respond_with with two arguments: `respond_with(CurrentUser.user, @api_key)`.
`options[0]` referred to the second argument, which was incorrect.
This commit is contained in:
@@ -29,15 +29,13 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def respond_with(subject, *options, &block)
|
def respond_with(subject, *args, model: model_name, **options, &block)
|
||||||
if params[:action] == "index" && is_redirect?(subject)
|
if params[:action] == "index" && is_redirect?(subject)
|
||||||
redirect_to_show(subject)
|
redirect_to_show(subject)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
model = options[0]&.delete(:model)
|
|
||||||
if subject.respond_to?(:includes) && (request.format.json? || request.format.xml?)
|
if subject.respond_to?(:includes) && (request.format.json? || request.format.xml?)
|
||||||
model ||= model_name
|
|
||||||
associations = ParameterBuilder.includes_parameters(params[:only], model)
|
associations = ParameterBuilder.includes_parameters(params[:only], model)
|
||||||
subject = subject.includes(associations)
|
subject = subject.includes(associations)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user