Pergunta

I used this solution based on devise_parameter_sanitizer to set some custom attributes to my Devise (User) model and make them available at sign_up and edit forms.

Everything works fine but from time to time (and it happens pretty often) specifically when I sign in, sign out or edit user (so I assume the problem is related to sessions), I get the following error:

Devise Parameter Sanitizer

Is there any logic that I can add to my code above to present this issue?

Foi útil?

Solução

I know this was a little while ago but wanted to put an answer here because this actually took me a bit to solve and other people might have a similar issue.

Because you used an initializer to load the User:ParameterSanitizer when you change the application controller or anything that would cause it to reload (because you are in debug mode) the initialization is lost.

This is easy to test to confirm this is what was happening to you: First: start the server fresh and go to your login page: should work. Next: modify application_controller.rb (just put a space somewhere and hit save) Next: visit your login page again (not working anymore) :(

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top