summaryrefslogtreecommitdiff
path: root/app/controllers/projects/variables_controller.rb
blob: 10efafea9db71657ba77d15e7e9cfe40e0d4d1d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Projects::VariablesController < Projects::ApplicationController
  before_action :authorize_admin_project!

  layout 'project_settings'

  def show
  end

  def update
    if project.update_attributes(project_params)
      redirect_to namespace_project_variables_path(project.namespace, project), notice: 'Variables were successfully updated.'
    else
      render action: 'show'
    end
  end

  private

  def project_params
    params.require(:project).permit({ variables_attributes: [:id, :key, :value, :_destroy] })
  end
end