I am following the Agile Web Development tutorials and I came across an annoying issue with the current implementation. if the session changes or expires, the cart still exists in the database. How is Rails supposed to deal with these useless cart objects?
Thanks
Normally, a background process will delete old shopping carts every so often. You need to guard against recreating the session while someone is shopping. Doing so would be considered a bug if you are using it to track the shopping cart.
If you also have a user-id, then the shopping cart with a user-id may be retrievable into an other session. In that case, the background process may keep them around longer than an anonymous shopping cart. Retrieving lost carts takes a little more code, but may be a nice feature.