diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-07 09:46:23 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-07 09:46:23 +0300 |
commit | 474d25e2e18b38f578ebce6f68009e5a154baadf (patch) | |
tree | 16179272e33a2589bbf2b3a10fe884b58143bd49 /app/controllers/projects/variables_controller.rb | |
parent | 4fbfe475d88553eb44c4d51bb535794d19348c40 (diff) |
Use variable_params && variable_params_attributes in project variables_controller.rb
Diffstat (limited to 'app/controllers/projects/variables_controller.rb')
-rw-r--r-- | app/controllers/projects/variables_controller.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index a7fd4c2657c..6a825137564 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -12,7 +12,7 @@ class Projects::VariablesController < Projects::ApplicationController end def update - if @variable.update(project_params) + if variable.update(variable_params) redirect_to project_variables_path(project), notice: 'Variable was successfully updated.' else @@ -21,7 +21,7 @@ class Projects::VariablesController < Projects::ApplicationController end def create - @variable = project.variables.create(project_params) + @variable = project.variables.create(variable_params) .present(current_user: current_user) if @variable.persisted? @@ -46,8 +46,12 @@ class Projects::VariablesController < Projects::ApplicationController private - def project_params - params.require(:variable).permit([:id, :key, :value, :protected, :_destroy]) + def variable_params + params.require(:variable).permit(*variable_params_attributes) + end + + def variable_params_attributes + %i[id key value protected _destroy] end def variable |