在rails中清除会话变量的最佳方式是什么?

时间:2021-12-21 20:07:55
session[:message]=nil

Is this is the best way to destroy a session variable.

这是销毁会话变量的最佳方式吗?

Note: I dont want to clear all the session variables like reset_session do.

注意:我不想清除所有的会话变量,比如reset_session。

1 个解决方案

#1


197  

session.delete(:message)

In general, session variable is SessionHash object, which is inherited from hash.

通常,会话变量是SessionHash对象,它是从hash继承而来的。

#1


197  

session.delete(:message)

In general, session variable is SessionHash object, which is inherited from hash.

通常,会话变量是SessionHash对象,它是从hash继承而来的。