I have a simple e-commerce store and am running into a problem with the edge rails cookie based sessions. What I am trying to do is make the customer fill in their info, and click "Review my Order". The order object is contructed, and stored in the session (if it passes validation). The is sent to another page where they can confirm all their info and press the "finalize order" button. The problem is that the order object is too large to fit in the session, and I get a CGI::Session::CookieStore::CookieOverflow exception. The addresses and other customer data overflow the 4k limit. So, without switching session stores, whats the best way to fix this? I don't really want to store the order object in the session, but it seemed like the easiest option. I thought about only storing the posted params from the order form, but that seems messy and doesn't save much in the way data size. I thought about saving the order to the database, but that seems wrong since the customer has not actually agreed to place the order yet. This is more or less what I am trying to do: def review session[:order] = Order.new(params[:order]) end def finalize session[:order].save end How can I do this without "abusing" the session by storing ActiveRecord object in it?
on 2007-03-31 03:42