Rails session record not deleted from sql

2019-09-01 02:44发布

问题:

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.