summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-01-26 19:25:48 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-01-27 12:04:54 +0100
commit95d2f0fb51de2c5800d41b7c4f285ed533ffe21a (patch)
tree3317b00e06c46c10fa5af8873b2bec218b08b407 /lib/api/helpers.rb
parent5e0ee54c6c89a4080e441c4407bb1087f5630040 (diff)
downloadgitlab-ce-95d2f0fb51de2c5800d41b7c4f285ed533ffe21a.tar.gz
Fix CI runner version not being properly updated when asking for a buildfix-ci-runners-version-update
Due to broken implementation of attribute_for_keys the runner information was not updated correctly. This MR adds test to check that such scenario will never happen again.
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 3f528b9f7c0..9dacf7c1e86 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -153,10 +153,11 @@ module API
end
def attributes_for_keys(keys, custom_params = nil)
+ params_hash = custom_params || params
attrs = {}
keys.each do |key|
- if params[key].present? or (params.has_key?(key) and params[key] == false)
- attrs[key] = params[key]
+ if params_hash[key].present? or (params_hash.has_key?(key) and params_hash[key] == false)
+ attrs[key] = params_hash[key]
end
end
ActionController::Parameters.new(attrs).permit!