I've done this in 2.2, but cannot figure it out for 2.3.2:
Basically, I want to be able to share session data across a couple of
apps.
The way I did this in 2.2 was to create a view called sessions in the
second app that read the sessions table of the first app.
This done, I could tell them both to use active record sessions, and,
lo! I had a shared session.
Once I'd written a little routine to swap between apps (to basically
clean out the session apart from user ids), I could then happily swap
back and forth between them.
Don't you need to be making the session cookie have a different domain
so that the cookie is sent to both apps ? I think some of the minutiae
of session options changed slightly with 2.3.2
That could well be part of it, but I'm afraid I'm not sure I follow you.
How would I go about doing that?
(I didn't need to with my old approach.)
Cheers,
Doug.
That could well be part of it, but I'm afraid I'm not sure I follow you.
How would I go about doing that?
(I didn't need to with my old approach.)
Ah, we may not be talking about the same thing. Are these apps on
different subdomains (eg app1.example.com, app2.example.com),
different domains, or on the same domain (example.com/app1 &
example.com/app2) ?
They're on the same machine, although I may want to move them at some
point.
that doesn't quite answer the question - even though they are on the
same machine any of the 3 scenarios I mentioned could be in effect.
What it boils down to in the end is cookies: there is a cookie that
tells rails which row from the sessions table to use and if both apps
aren't getting the same value out of this cookie then although the
sessions are backed by the same table they will appear as different
users.
Ah, I see, sorry -- well, they'll be on the same machine, but that is on
a local network (these are internal apps), and they are accessed by
names like "app1", "app2", with the local server's DNS resolving them to
the server address, and passenger and phusion taking over from there.
That's the idea, anyway -- I had the proof-of-concept working, but
needed to upgrade the apps to 2.3.2 before deploying them.
You can probably tell this isn't my area of expertise!
& thanks for your continued advice.
Doug.
So if I have (locally) my apps all called things like "app1.local" and
"app2.local", then I could set the domain to ".local", which would
generate a "local" cookie that would be available to both apps, enabling
them to share a session?
Sorry if I'm labouring the point -- I've had my head in this all day &
am correspondingly slow tonight!
& thankyou,
Doug.