I have made a hidden field on login form which contain user timezone and now i want to set it on that user session. I’m using devise for authentication. When using params[:hiddenfieldname] values are not accessible in the controller where I’m redirecting the user to home page. Please tell me what are the steps I’m missing.
I have made a hidden field on login form which contain user timezone and
Share
I don’t think there’s enough information in the question to provide a definitive answer; if not, please post the code you have that isn’t working. Here’s my guess…
When you log in (or out) using Devise, these actions are managed by the Devise::SessionController. After logging a user in, part of that controller redirects the user to a location (home, by default), at which point the
paramsarray is cleared.You’ll want to override the relevant methods of that controller in your code so that you can capture the value of the timezone in
paramsinto the session before the rest of the Devise login process runs. Something likeThis code would live in
apps/controllers/devise_custom/session_controller.rbin your project.EDIT:
You’ll also need to update the
routes.rbto specify your custom path for the new controller, like so