Cookie session domain for many sites


I have an issue that I think right now is like a “rails cliche”:

I’m developing a Network, with a main site and secondary sites. The idea
is that when you login in the main site, automatically you are login in
the secondary sites (and viceversa). The obvious solution (one part at
least) is that when you login, the domain of the cookie will be the

I read a lot about this issue and possible solutions but nothing works
for me. First, I have to clarify that I’m using Rails 2.1.1 and for many
reasons I have with stay put with it. I clarify this because I read
about solutions but with Rails 2.3 (like this … n-rails-23)

This other solution: … e+in+rails

definitively doesn’t work.

I try even modifing the write_cookie method in the cookie_store.erb,
trying to “force” the domain, but with no positive results (modifying
@cookie_options or options or setting new variables).

And when I try to put lines like this in the environment.erb:

ActionController::Base.session_options[:session_domain] = ‘’

and then I try login, I got ActionController::InvalidAuthenticityToken

I use almost all solutions that I found “googling”(?) and I create my
new recipes “mixing” this solutions but the thing doesn’t work.

Any ideas? Anybody knows one possible solution? I have to use Rails 2.3?


So what worked? Did you ever solve it?

On Jun 29, 2:33 am, Dario P. [email protected]