What is the best way to clear a session variable in rails?
Ruby on-RailsSessionRuby on-Rails Problem Overview
session[:message] = nil
Is this is the best way to destroy a session variable.
Note: I don't want to clear all the session variables like reset_session
does.
Ruby on-Rails Solutions
Solution 1 - Ruby on-Rails
session.delete(:message)
In general, session variable is SessionHash
object, which is inherited from hash.