shared sessions and rails2

Hi all

How would you go about sharing a session between two rails2 applications? I am using restful_authentication.

A point in the direction of some relevant blogs would also be a great help.

Regards
Ivor

Hi all

How would you go about sharing a session between two rails2
applications? I am using restful_authentication.

A point in the direction of some relevant blogs would also be a
great help.

This largely depends on what backend you use. If you set the session
key (ie in the initializer block, stick
config.action_controller.session = { :session_key => '_some_key'} )
then both apps should use the same cookie to track the session. You're
also need to be serving both apps from the same host (so that the
browser does actually send the same cookies to both apps, otherwise
you don't have a hope in hell)
What happens next largely depends on what backend you are using to
store sessions:
- cookiestore: the cookie is the session, so if your apps can share
cookies you should be golden
- activerecordstore/other db backed session stores: both apps will
need access to a common database
- pstore: you'll need to set the apps to write the session files to
some common directory both can access
- memcache/drbstore: I've never used these.

So, in summary it's probably possible. You should also be aware that 2
simultaneous actions can result in the session being slightly clobbered.

Fred