Ticket #379 (closed enhancement: fixed)

Opened 9 months ago

Last modified 8 months ago

session.delete(:key) ?

Reported by: dcpark..@gmail.com Assigned to:
Priority: medium Milestone: 0.5.0
Component: Merb Keywords:
Cc:

Description

Can we add a session.delete(:key) method to sessions to make it behave more like a regular hash? There is currently a session.delete method, but that receives no arguments and just empties the session. It'd be easy enough to just add an optional argument and delete a key from the data hash if a key is provided, or empty the session otherwise. Although that could be a little volatile, we wouldn't want to have a key passed accidentally == nil, and end up emptying the session. Could the method naming be more clear? I propose session.clear! to clear out the session, session.delete(:key) for the normal hash operation.

Attachments

clear-delete.patch (0.5 kB) - added by dcpark..@gmail.com on 12/28/07 06:46:59.

Change History

12/28/07 06:46:59 changed by dcpark..@gmail.com

  • attachment clear-delete.patch added.

12/28/07 11:36:27 changed by dcpark..@gmail.com

Maybe related. What is the aim of the session? SHOULD the session object be emulating operations on its data hash as best it can? Or should we be seeing the session record at all? Can the session method simply return the session record's unmarshaled data property?

Another question came up -- marshaling / unmarshaling doesn't seem to support symbols. Should we allow symbols to be used, automatically converting them to string key references, or should it be known far and wide that sessions don't allow symbols? (and it probably shouldn't simply silently fail).

01/02/08 23:49:02 changed by wyca..@gmail.com

  • status changed from new to closed.
  • resolution set to fixed.

(In [1152]) Closes #379; session.delete(:key) on all ORMS; TODO: extract generic session stuff into a mixin