Fix StrongAttibutes error with Ruby 2.1

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2016-11-21 17:44:24 +01:00
parent 80eaed1651
commit 039d4a1cbf
No known key found for this signature in database
GPG key ID: 46DF07E5CD9E96AB

View file

@ -140,7 +140,8 @@ module API
User.where(username: params[:username]).
where.not(id: user.id).count > 0
identity_attrs = params.slice(:provider, :extern_uid)
user_params = declared_params(include_missing: false)
identity_attrs = user_params.slice(:provider, :extern_uid)
if identity_attrs.any?
identity = user.identities.find_by(provider: identity_attrs[:provider])
@ -154,10 +155,10 @@ module API
end
# Delete already handled parameters
params.delete(:extern_uid)
params.delete(:provider)
user_params.delete(:extern_uid)
user_params.delete(:provider)
if user.update_attributes(declared_params(include_missing: false))
if user.update_attributes(user_params)
present user, with: Entities::UserFull
else
render_validation_error!(user)