summaryrefslogtreecommitdiff
path: root/app/controllers/variables_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/variables_controller.rb')
-rw-r--r--app/controllers/variables_controller.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/variables_controller.rb b/app/controllers/variables_controller.rb
index 6eb908e..00f60f3 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 project_variables_path(project), notice: 'Variables were 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