feat(profiles): add strong params
This commit is contained in:
parent
6a0a674328
commit
27f9d3bda9
2 changed files with 23 additions and 19 deletions
|
@ -47,7 +47,7 @@ class ProfilesController < ApplicationController
|
||||||
else
|
else
|
||||||
current_user.profile
|
current_user.profile
|
||||||
end
|
end
|
||||||
@profile.update_attributes(params[:profile])
|
@profile.update_attributes(profile_params)
|
||||||
json_saved @profile, 'Profile updated'
|
json_saved @profile, 'Profile updated'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,4 +69,10 @@ class ProfilesController < ApplicationController
|
||||||
redirect_to root_url
|
redirect_to root_url
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -2,24 +2,22 @@
|
||||||
|
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
class Profile < ApplicationRecord
|
class Profile < ApplicationRecord
|
||||||
# TODO
|
# :registered, # bool
|
||||||
# attr_accessible \
|
# :mini_bio,
|
||||||
# :registered, # bool
|
# :first_name, # str
|
||||||
# :mini_bio,
|
# :last_name, # str
|
||||||
# :first_name, # str
|
# :name,
|
||||||
# :last_name, # str
|
# :phone, # str
|
||||||
# :name,
|
# :address, # str
|
||||||
# :phone, # str
|
# :email, # str
|
||||||
# :address, # str
|
# :city, # str
|
||||||
# :email, # str
|
# :state_code, # str (eg. CA)
|
||||||
# :city, # str
|
# :zip_code, # str
|
||||||
# :state_code, # str (eg. CA)
|
# :privacy_settings, # text [str]: XXX deprecated
|
||||||
# :zip_code, # str
|
# :picture, # str: either their social network pic or a stored pic on S3
|
||||||
# :privacy_settings, # text [str]: XXX deprecated
|
# :anonymous, # bool: negates all privacy_settings
|
||||||
# :picture, # str: either their social network pic or a stored pic on S3
|
# :city_state,
|
||||||
# :anonymous, # bool: negates all privacy_settings
|
# :user_id
|
||||||
# :city_state,
|
|
||||||
# :user_id
|
|
||||||
|
|
||||||
validates :email, format: { with: Email::Regex }, allow_blank: true
|
validates :email, format: { with: Email::Regex }, allow_blank: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue