Rails session record not deleted from sql

时间秒杀一切 提交于 2019-12-13 05:24:19

问题


I see that when I click logout, I set the session variables to NIL and call reset_session. I see that the entry from the SQL DB is not deleted on this (but the session looks to get invalidated).

I see that though the entry in SQL is not deleted for the session id, the data in the session gets changed on executing the destroy call.

def destroy
    session[:user_id] = nil
    reset_session
end

I am running on rails 3.2.13. The destroy does not remove the entry from SQL:

mysql> select * from sessions;
+-----+----------------------------------+----------------------------------------------------------------------------------------+---------------------+---------------------+
| id  | session_id                       | data                                                                                   | created_at          | updated_at          |
+-----+----------------------------------+----------------------------------------------------------------------------------------+---------------------+---------------------+
| 155 | e5e458c3dc93fd34193984b02790c2bf | BAh7BiIQX2NzcmZfdG9rZW4iMStlQXoycTVwWi9BZDRNNlZwZmhIYURITG1q
cmgyN0lSTHFzYjFQY3UzZmM9
 | 2014-07-29 21:54:55 | 2014-07-29 21:54:55 |
+-----+----------------------------------+----------------------------------------------------------------------------------------+---------------------+---------------------+

Thanks.

来源:https://stackoverflow.com/questions/25025702/rails-session-record-not-deleted-from-sql

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