Fellow Rubyists, I have been scratching my head on this one for a while: I have an e-commerce app in production with pretty standard add-to-cart functionality. Whenever a user starts an order, I add the order id to the session and read it back on subsequent requests (like showing the cart, checkout form, etc). By and large, this works as expected in my tests and testing with local browsers.
However, for a small number of my users, the session doesn't seems to keep the order id. In actions where I would expect the order id to be there, it is not. For example, I have a OrdersController#update action that, well, updates the order. Following convention, that actions forwards to OrdersController#show. Since the session[:order_id] was present in #update, I would obviously expect it to be set in #show, and for most users it is, but for some it is not. I am obviously, checking that the user is not visiting #show before #update or #create has been called. Random stuff that I think might make a difference * It is not restricted to any one browser/version. It happens with IE, Firefox, etc. * It happens with browsers that have cookies (I can see when analyzing requests, that the cookies headers are being sent, it just that the session doesn't contain the expected variable/value). * Running Rails 3.1 on heroku with default session store. Currently, my only hunch is that the users browser is not sending the latest version of a cookie (with the order_id set in the session) but the original one generated when the first visited the site (where the session[:order_id] has not been set). Has anyone experiences something like this? Would using another kind of cookie store solve this? Thanks for the help, -- Ylan Segal [email protected] Tel: +1-858-224-7421 Fax: +1-858-876-1799 -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
