Should rails sessions remain after the browser has closed?

Hi,

Just double checking - should rails sessions remain after the browser
has
closed???

I’m running active record sessions (i.e. persisted to database via
active
record), however I note that closing the browser and re-opening builds
up
multiple sessions in the database table. Is this expected behavior for
a
session?

Tks

Yes - your webserver doesn’t (and realistically cannot) know if the user
has closed their browser. The cookie which enabled them to get at that
session however has gone away, and so you get a new session, as
expected.
This does mean that session build up over time, most people have some
form of cron jobs that clears out their old sessions.

Fred

On 11/14/06, Greg H. [email protected] wrote:

Tks

Greg,

This is normal behavior. You need to cleanup these sessions yourself
which can easily be done with rake during development (rake
db:sessions:clear) or a cron job in production
(http://depixelate.com/2006/11/10/quick-tip-flexible-session-sweeping).

Hope this helps.


Zack C.
http://depixelate.com