feat(profiles): add strong params

This commit is contained in:
Luis Castro 2019-08-06 16:07:46 +02:00 committed by Eric Schultz
parent 6a0a674328
commit 27f9d3bda9
2 changed files with 23 additions and 19 deletions

View file

@ -47,7 +47,7 @@ class ProfilesController < ApplicationController
else
current_user.profile
end
@profile.update_attributes(params[:profile])
@profile.update_attributes(profile_params)
json_saved @profile, 'Profile updated'
end
@ -69,4 +69,10 @@ class ProfilesController < ApplicationController
redirect_to root_url
end
end
private
def profile_params
params.require(:profile).permit(:registered, :mini_bio, :first_name, :last_name, :name, :phone, :address, :email, :city, :state_code, :zip_code, :privacy_settings, :picture, :anonymous, :city_state, :user_id)
end
end

View file

@ -2,8 +2,6 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class Profile < ApplicationRecord
# TODO
# attr_accessible \
# :registered, # bool
# :mini_bio,
# :first_name, # str