diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-21 12:20:25 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-21 12:21:08 +0100 |
commit | fe9a1e31f5255b34b43974c303410063c07cc292 (patch) | |
tree | 95d0e0325d08eac6e87863d49c40afe1a9fd1341 /app/controllers | |
parent | ee7e4fd34196003d8f3899704e5c537d965b7a9a (diff) | |
download | gitlab-ci-fe9a1e31f5255b34b43974c303410063c07cc292.tar.gz |
Update variables from within it's own controller not the project's
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/variables_controller.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/variables_controller.rb b/app/controllers/variables_controller.rb index 6eb908e..754ebf3 100644 --- a/app/controllers/variables_controller.rb +++ b/app/controllers/variables_controller.rb @@ -6,7 +6,17 @@ class VariablesController < ApplicationController layout 'project' - def index + def show + end + + def update + if project.update_attributes(project_params) + EventService.new.change_project_settings(current_user, project) + + redirect_to :back, notice: 'Variables was successfully updated.' + else + render action: 'show' + end end private @@ -14,4 +24,8 @@ class VariablesController < ApplicationController def project @project ||= Project.find(params[:project_id]) end + + def project_params + params.require(:project).permit({ variables_attributes: [:id, :key, :value, :_destroy] }) + end end |