Skip to content
Snippets Groups Projects
Verified Commit 53915c5c authored by Matija Čupić's avatar Matija Čupić
Browse files

Alias secret_key and secret_value to key and value

parent 763c82f0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -35,12 +35,7 @@ module Groups
end
 
def group_variables_params
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
params.permit(variables_attributes: [*variable_params_attributes])
end
 
def variable_params_attributes
Loading
Loading
Loading
Loading
@@ -32,12 +32,7 @@ class Projects::VariablesController < Projects::ApplicationController
end
 
def variables_params
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
params.permit(variables_attributes: [*variable_params_attributes])
end
 
def variable_params_attributes
Loading
Loading
Loading
Loading
@@ -6,6 +6,9 @@ module Ci
 
belongs_to :group
 
alias_attribute :secret_key, :key
alias_attribute :secret_value, :value
validates :key, uniqueness: {
scope: :group_id,
message: "(%{value}) has already been taken"
Loading
Loading
Loading
Loading
@@ -6,6 +6,9 @@ module Ci
 
belongs_to :project
 
alias_attribute :secret_key, :key
alias_attribute :secret_value, :value
validates :key, uniqueness: {
scope: [:project_id, :environment_scope],
message: "(%{value}) has already been taken"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment