Forum: Rails deployment emptying cart

Posted by Alessandro Mattioli (allemattio)
on 2010-02-28 01:11
hi.
i'm new to ruby on rails
I have a big problem
I'm writing a program wich has a Product class(active record) wich
contains the product I want to sell..and a Cart class where i save the
Products I want to buy...each product has a availability field that i
decrement when I add the product to the cart...
Now
if I empty the cart by clicking a link I can empty the cart and restore
the right availability for each product that was in the cart before
but if I close the browser with the cart not empty, it gets empty, but
the availability is not restored correctly

Is there a way to fix this problem? is there a way to 'intercept' the
termination of the browser? or an event that is called at the
application terminate? or a decontructor method for my class Cart?

i red something browsing the web but I was unable to fix this problem

please help me
thanks
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.