From 8fee5a0572372b1d3a69fa1816380eb11182afaf Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 26 Jun 2014 23:24:17 +0300 Subject: Make app works with strong params Signed-off-by: Dmitriy Zaporozhets --- lib/api/helpers.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/api/helpers.rb') 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 -- cgit v1.2.1