Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Rails 4.0 and Devise With Strong Params and Custom Fields Discussion

General • Asked by Chris Oliver

Short and simple. Thanks a lot. I've been looking for a solution all morning.

This works for me except i use simple_form_for

Rodrigo Sanguanini

You can use instead of

devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :full_name, :phone) }


devise_parameter_sanitizer.for(:sign_up) << :full_name, :phone

Thanks Rodrigo! Definitely a cleaner implementation because this way you're only adding fields.

How do permit strong parameters if I have multiple devise models?

That's a good question. I've never actually checked into that. You should ask on the Github Issues for Devise. They'll definitely know the answer to that.

Fixed it. I just inherited Devise::ParameterSanitizer to Admin::ParameterSanitizer and User::ParameterSanitizer and wrote my logic for all pages, sign_in sign_up etc. as separate mthods. Works just fine.

How to Keep form fields filled after an error in signup?

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.