How to load Rails Session from session_id? -
i using myapp::application.config.session_store :active_record_store
in application store sessions in database. works fine. however, i'd able load specific session when passed session_id
. value server stores cookie on client side.
my rails application has client can't use cookies, has pass me session_id
in parameter. i'd use before_action
or sort of filter take parameter , use load session
in controllers instead of app loading null session due lack of proper cookies.
is there way can this? don't want turn off cookie method altogether because web client uses cookies, it's mobile client can't.
edit: if declare class session < activerecord::base
, session.find_by_session_id('whatever')
session activerecord object, i'm not sure how make usable session
in normal rails sense.
just request.session_options[:id] = "whatever want" in before_action filter , rails use session_id load session when access (thanks lazy loading).
Comments
Post a Comment