From 327deb9cbb6950e785ebdcc9f3489657c6bc302a Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 5 Feb 2021 02:53:52 -0600 Subject: [PATCH] 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. --- app/controllers/application_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fbb8a0719..b3f45259c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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