Dear list,
the Rails app, I'm currently working on will run on more than one domain (e.g. example.com and example.org) and uses subdomains for different projects. To implement cross-project logins, I'd like the session cookie to cover the whole current domain (e.g. .example.com if somebody visits foo.example.com or bar.example.com, but .example.org if somebody visits foo.example.org).
I know how to configure the session cookie application-wide (by using the session() class method in a controller), but how can I modify the session cookie settings for each request? There doesn't seem to be instance methods to do so.
I don't think that modifying global settings in an action (like ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(...) ) is a good idea. It probably works in a development environment, but I suppose it will break when running in a production environment (where classes are not reloaded and class methods may affect other more than one request).
Somewhere on the web, I found a posting that recommended to override the _session_id cookie by setting it via cookies['_session_id'] = { ... }. However this did not work for me - the result contained an HTTP header with two _session_id cookies (one from the session plus the one I created manually, both having the same cookie name)
I'd appreciate any ideas
regards, Andreas Neuhaus