Problem with devise

9 views
Skip to first unread message

Rakesh Ranjan

unread,
Mar 8, 2016, 8:04:45 AM3/8/16
to BANGALORE RUG-Ruby Users Group
Hi. all 

I am working on a website on devise.
I am not able to add additional parameter in sign_up.
I have already added to account_update , but with sign_up it is not working.

my codes are:-
  def configure_devise_permitted_parameters

if params[:action] == 'update'
devise_parameter_sanitizer.for(:account_update) do |user_params|
user_params.permit(:current_password , :first_name, :middle_name, :last_name, :phone_number, :gender, :aadhar_number, :date_of_birth, :occupation, )
end
elsif params[:action] == 'create'
devise_parameter_sanitizer.for(:sign_up) do |user_params|
user_params.permit(:email, :password, :password_confirmation, :category_id, :first_name, :last_name, :phone_number, :gender, :aadhar_no, :date_of_birth)
end

Awin Abi

unread,
Mar 8, 2016, 1:30:27 PM3/8/16
to BANGALORE RUG-Ruby Users Group
Hi Rakesh,

Don't think that you would want to have the if conditions for params[:action]. You can use devise_parameter_sanitizer for the right actions and devise would handle it for you.
May be you should figure out if the issue is in strong parameters, or in save. (pry can be of help here)

Thanks,
- Awin
Reply all
Reply to author
Forward
0 new messages