small medium large xlarge

Generic-user-small
02 May 2011, 14:24
jb007 (2 posts)

Hi,

Excellent book, I like how it takes you through an entire application instead of focusing on code snippets.

I do have a problem though. When a cart is created and stored in the session, it (and all related line items) remains in the database when the session expires (i.e. times out) and if this was a real application then those tables would fill up pretty quickly and slow down the system.

I’m quite new to Rails so I’m not sure how to fix this, is there a way to “associate” the line items and cart records in the database with the session so that Rails knows to remove those records when the session expires or will I need to create some sort of cron job to clean them up periodically?

Thanks!

Generic-user-small
02 May 2011, 14:26
jb007 (2 posts)

Note, I know that SessionsController has a destroy method and I can call cart.destroy in there but this doesn’t seem to get called when the user doesn’t explicitly log-out i.e. they left the session open but closed the browser.

Thanks!

You must be logged in to comment