This is the very rare case but some times we need to access the data stored in session through session_id(specially when the request is not coming from browser). Here is a way I found and like to share:
@user=CGI::Session::ActiveRecordStore::Session.find_by_session_id(@session_id).data[:user]
This was the line a realy needed. Thanks so much.
Great stuff. Many thanks!
Thanks a lot mate
zVOoYG hi nice site thx http://peace.com
thanks for sharing dude!
thanks for the great info
great rails
Thanks for sharing, i would not have enjoyed figuring this out myself.
Enjoyed the read, will bookmark.
It’s good to receive the data from a specific session id, but in my case, the current session id keeps changing because there is no cookie enabled in my browser. The session database (I set the sessions to be stored in database) is full of useless sessions since the new request will receive a new session id. Is there a way to reuse the current session id in a new request without cookie? Thnx.
[...] 参见: /2006/12/08/accessing-session-data-using-session_id/ [...]