如何清空/销毁 Rails 中的会话? [英] How to empty/destroy a session in rails?
本文介绍了如何清空/销毁 Rails 中的会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎在任何地方都找不到它...如何在 Rails 中删除/销毁/重置/清空/清除用户的会话?不只是一个价值,而是整个事情..
I can't seem to find it anywhere... How do I delete/destroy/reset/empty/clear a user's session in Rails? Not just one value but the whole thing..
推荐答案
要清除整个事情,请使用控制器中的 reset_session 方法.
To clear the whole thing use the reset_session method in a controller.
reset_session
这是关于此方法的文档:http://api.rubyonrails.org/classes/ActionController/Base.html#M000668
Here's the documentation on this method: http://api.rubyonrails.org/classes/ActionController/Base.html#M000668
通过清除所有重置会话存储在和中的对象初始化一个新的会话对象.
Resets the session by clearing out all the objects stored within and initializing a new session object.
祝你好运!
这篇关于如何清空/销毁 Rails 中的会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文