Rails 2.3 session

Posted by Sam Kong on Stack Overflow See other posts from Stack Overflow or by Sam Kong
Published on 2009-06-24T00:21:00Z Indexed on 2010/06/08 8:22 UTC
Read the original article Hit count: 400

Hi,

I am developing a rails 2.3.2 app. I need to keep session_id for an order record, retrieve it and finally delete the session_id when the order is completed. It worked when I used cookies as session store but it doesn't for active_record store. (I restarted my browser, so no cache issue.)

I know rails 2.3 implements lazy session load. I read some info about it but am still confused.

Can somebody clarify how I use session_id for such a case?

What I am doing is...

A user make an order going through several pages.
There is no sign-up, neither login.
So I keep session_id in the order record so that no other user can access the order.
@order = Order.last :conditions => {:id => params[:id], :session_id => session[:session_id] }
When the order is finished, I set nil to session_id column.

How would you implement such a case in lazy session(and active_record store) environment?

Thanks.

Sam

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about session