Commit 2dd9a9af authored by Shinya Maeda's avatar Shinya Maeda

Fix variables_controller.rb and format

parent d228662f
...@@ -46,8 +46,7 @@ module Groups ...@@ -46,8 +46,7 @@ module Groups
end end
def group_params def group_params
params.require(:variable) params.require(:variable).permit([:key, :value, :protected])
.permit([:key, :value, :protected])
end end
def variable def variable
......
...@@ -13,18 +13,21 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -13,18 +13,21 @@ class Projects::VariablesController < Projects::ApplicationController
def update def update
if @variable.update(project_params) if @variable.update(project_params)
redirect_to namespace_project_variables_path(project.namespace, project), notice: 'Variable was successfully updated.' redirect_to namespace_project_variables_path(project.namespace, project),
notice: 'Variable was successfully updated.'
else else
render "show" render "show"
end end
end end
def create def create
@variable = Ci::Variable.new(project_params) new_variable = Ci::Variable.new(project_params)
if @variable.valid? && @project.variables << @variable if new_variable.valid? && @project.variables << new_variable
redirect_to namespace_project_settings_ci_cd_path(project.namespace, project), notice: 'Variables were successfully updated.' redirect_to namespace_project_settings_ci_cd_path(project.namespace, project),
notice: 'Variables were successfully updated.'
else else
@variable = new_variable.present(current_user: current_user)
render "show" render "show"
end end
end end
...@@ -40,8 +43,7 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -40,8 +43,7 @@ class Projects::VariablesController < Projects::ApplicationController
private private
def project_params def project_params
params.require(:variable) params.require(:variable).permit([:id, :key, :value, :protected, :_destroy])
.permit([:id, :key, :value, :protected, :_destroy])
end end
def variable def variable
......
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