diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-07 17:14:29 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-07 17:14:29 +0900 |
commit | 3b2f09289f64850586af2b2db54466fe230c907c (patch) | |
tree | 4202b48a85874b7704a02622ccbaccd997ace24c /app/controllers/groups | |
parent | 474d25e2e18b38f578ebce6f68009e5a154baadf (diff) | |
download | gitlab-ce-3b2f09289f64850586af2b2db54466fe230c907c.tar.gz |
Name as variable_params like project variable controller
Diffstat (limited to 'app/controllers/groups')
-rw-r--r-- | app/controllers/groups/variables_controller.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb index 423f11e2234..10038ff3ad9 100644 --- a/app/controllers/groups/variables_controller.rb +++ b/app/controllers/groups/variables_controller.rb @@ -11,7 +11,7 @@ module Groups end def update - if variable.update(group_params) + if variable.update(variable_params) redirect_to group_variables_path(group), notice: 'Variable was successfully updated.' else @@ -20,7 +20,7 @@ module Groups end def create - @variable = group.variables.create(group_params) + @variable = group.variables.create(variable_params) .present(current_user: current_user) if @variable.persisted? @@ -45,16 +45,20 @@ module Groups private - def authorize_admin_build! - return render_404 unless can?(current_user, :admin_build, group) + def variable_params + params.require(:variable).permit(*variable_params_attributes) end - def group_params - params.require(:variable).permit([:key, :value, :protected]) + def variable_params_attributes + %i[key value protected] end def variable @variable ||= group.variables.find(params[:id]).present(current_user: current_user) end + + def authorize_admin_build! + return render_404 unless can?(current_user, :admin_build, group) + end end end |