In ruby on rails when doing session[:foo] = nil
it leaves an entry named :foo
in the session object. How can you get rid of that single entry from the session object?
It looks like the simplest version works. All stores (Cookie, File, ActiveRecord, ...) use AbstractStore::SessionHash
as the object that contains the data, the different stores provide only the means to load and save the AbstractStore::SessionHash
instances.
AbstractStore::SessionHash
inherits from Hash
, so this defers to the Hash#delete
method:
session.delete(:key_to_delete)