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,8 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| # 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 |  | ||||||
|   # attr_accessible \ |  | ||||||
|   # :registered, # bool |   # :registered, # bool | ||||||
|   # :mini_bio, |   # :mini_bio, | ||||||
|   # :first_name, # str |   # :first_name, # str | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Luis Castro
						Luis Castro