summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-30 17:01:22 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-30 17:01:22 +0000
commit4f0bfdb500b7f72a8e817d1224eaba6ed46204bc (patch)
tree5b1daaaf1a15aa659190288bd3fc23cead46f591 /lib/api/helpers.rb
parent76e36dd253229d580f2c6336a77e5fc403fe90c3 (diff)
parent4967c087862e5c7c5009605000380d4451ce07ec (diff)
downloadgitlab-ce-4f0bfdb500b7f72a8e817d1224eaba6ed46204bc.tar.gz
Merge branch 'strong-parameters' into 'master'
Strong parameters Replace protected_attributes with strong parameters. Fixes #1340
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index b6a5806d646..d7d209e16f7 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -98,10 +98,14 @@ module API
def attributes_for_keys(keys)
attrs = {}
+
keys.each do |key|
- attrs[key] = params[key] if params[key].present? or (params.has_key?(key) and params[key] == false)
+ if params[key].present? or (params.has_key?(key) and params[key] == false)
+ attrs[key] = params[key]
+ end
end
- attrs
+
+ ActionController::Parameters.new(attrs).permit!
end
# error helpers