What is the best way to clear a session variable in rails?

前端 未结 1 975
既然无缘
既然无缘 2021-01-31 07:07
session[:message] = nil

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

Note: I don\'t want to clear all the session va

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-31 07:09

    session.delete(:message)
    

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

    0 讨论(0)
提交回复
热议问题