BigW Consortium Gitlab

Commit 3b2f0928 by Shinya Maeda

Name as variable_params like project variable controller

parent 474d25e2
...@@ -11,7 +11,7 @@ module Groups ...@@ -11,7 +11,7 @@ module Groups
end end
def update def update
if variable.update(group_params) if variable.update(variable_params)
redirect_to group_variables_path(group), redirect_to group_variables_path(group),
notice: 'Variable was successfully updated.' notice: 'Variable was successfully updated.'
else else
...@@ -20,7 +20,7 @@ module Groups ...@@ -20,7 +20,7 @@ module Groups
end end
def create def create
@variable = group.variables.create(group_params) @variable = group.variables.create(variable_params)
.present(current_user: current_user) .present(current_user: current_user)
if @variable.persisted? if @variable.persisted?
...@@ -45,16 +45,20 @@ module Groups ...@@ -45,16 +45,20 @@ module Groups
private private
def authorize_admin_build! def variable_params
return render_404 unless can?(current_user, :admin_build, group) params.require(:variable).permit(*variable_params_attributes)
end end
def group_params def variable_params_attributes
params.require(:variable).permit([:key, :value, :protected]) %i[key value protected]
end end
def variable def variable
@variable ||= group.variables.find(params[:id]).present(current_user: current_user) @variable ||= group.variables.find(params[:id]).present(current_user: current_user)
end end
def authorize_admin_build!
return render_404 unless can?(current_user, :admin_build, group)
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment