diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-04 01:28:55 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-07 15:35:12 +0900 |
commit | 2dd9a9af2f0033be8fb627e2113710505874008b (patch) | |
tree | 8ef9ea4358000ea524ce8c2ec74a1fdb6529edcf /app | |
parent | d228662fb7cfdfaea749e4b733197e3d3a9ac23b (diff) | |
download | gitlab-ce-2dd9a9af2f0033be8fb627e2113710505874008b.tar.gz |
Fix variables_controller.rb and format
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/groups/variables_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects/variables_controller.rb | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb index 6fba9dab2a7..beafea7b451 100644 --- a/app/controllers/groups/variables_controller.rb +++ b/app/controllers/groups/variables_controller.rb @@ -46,8 +46,7 @@ module Groups end def group_params - params.require(:variable) - .permit([:key, :value, :protected]) + params.require(:variable).permit([:key, :value, :protected]) end def variable diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index 716e1347604..dbd1e506002 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -13,18 +13,21 @@ class Projects::VariablesController < Projects::ApplicationController def update 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 render "show" end end def create - @variable = Ci::Variable.new(project_params) + new_variable = Ci::Variable.new(project_params) - if @variable.valid? && @project.variables << @variable - redirect_to namespace_project_settings_ci_cd_path(project.namespace, project), notice: 'Variables were successfully updated.' + if new_variable.valid? && @project.variables << new_variable + redirect_to namespace_project_settings_ci_cd_path(project.namespace, project), + notice: 'Variables were successfully updated.' else + @variable = new_variable.present(current_user: current_user) render "show" end end @@ -40,8 +43,7 @@ class Projects::VariablesController < Projects::ApplicationController private def project_params - params.require(:variable) - .permit([:id, :key, :value, :protected, :_destroy]) + params.require(:variable).permit([:id, :key, :value, :protected, :_destroy]) end def variable |