Accessing the new session_id in devise after sign_in

和自甴很熟 提交于 2019-12-02 07:49:10

问题


I am using devise & overriding SessionsController#create to track the login based on a specific condition.

The value of session[:session_id] before sign_in(user) is same even after the execution of sign_in(user).

I would like to store the new session_id in DB in order to track the user. But unable to access it. How to get it?

While looking for it, found that Devise uses set_user method of Warden. But even then, I could not figure out where the session is set in Warden.


回答1:


Found the answer in the following question:

Rails ActiveRecord store and new session

Answer by Benjamin Sinclaire worked for me (though it was not marked as answer). Just replaced session.options with request.session_options



来源:https://stackoverflow.com/questions/32439212/accessing-the-new-session-id-in-devise-after-sign-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!