From 28a5f8c60a29445e147614767a8452b3141ef868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Fri, 16 Mar 2018 16:54:36 +0100 Subject: Use secret_key and secret_value in Variables controller --- app/controllers/projects/variables_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/controllers/projects/variables_controller.rb') diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index 7eb509e2e64..3cbfe7b3cc1 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -32,10 +32,15 @@ class Projects::VariablesController < Projects::ApplicationController end def variables_params - params.permit(variables_attributes: [*variable_params_attributes]) + filtered_params = params.permit(variables_attributes: [*variable_params_attributes]) + filtered_params["variables_attributes"].each do |variable| + variable["key"] = variable.delete("secret_key") + variable["value"] = variable.delete("secret_value") + end + filtered_params end def variable_params_attributes - %i[id key value protected _destroy] + %i[id secret_key secret_value protected _destroy] end end -- cgit v1.2.1