diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-20 17:34:04 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-20 17:51:07 +0100 |
commit | 6448368b5b71d9c93b865d2cad0206b475db4553 (patch) | |
tree | ac26a315400e40ceba27eb37cadef461f2d77e54 /lib/api/variables.rb | |
parent | 115ffa3749300b58d7161610e27a41b844b3fb80 (diff) | |
parent | 7f78a78a36a4341680a71afa5a12a1f4d4876c66 (diff) | |
download | gitlab-ce-6448368b5b71d9c93b865d2cad0206b475db4553.tar.gz |
Merge remote-tracking branch 'origin/master' into ide
Diffstat (limited to 'lib/api/variables.rb')
-rw-r--r-- | lib/api/variables.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 381c4ef50b0..7fa528fb2d3 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -45,7 +45,9 @@ module API optional :protected, type: String, desc: 'Whether the variable is protected' end post ':id/variables' do - variable = user_project.variables.create(declared(params, include_parent_namespaces: false).to_h) + variable_params = declared_params(include_missing: false) + + variable = user_project.variables.create(variable_params) if variable.valid? present variable, with: Entities::Variable @@ -67,7 +69,9 @@ module API return not_found!('Variable') unless variable - if variable.update(declared_params(include_missing: false).except(:key)) + variable_params = declared_params(include_missing: false).except(:key) + + if variable.update(variable_params) present variable, with: Entities::Variable else render_validation_error!(variable) |