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
|
||||
|
||||
def respond_with(subject, *options, &block)
|
||||
def respond_with(subject, *args, model: model_name, **options, &block)
|
||||
if params[:action] == "index" && is_redirect?(subject)
|
||||
redirect_to_show(subject)
|
||||
return
|
||||
end
|
||||
|
||||
model = options[0]&.delete(:model)
|
||||
if subject.respond_to?(:includes) && (request.format.json? || request.format.xml?)
|
||||
model ||= model_name
|
||||
associations = ParameterBuilder.includes_parameters(params[:only], model)
|
||||
subject = subject.includes(associations)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user