2
votes

I've followed the ascii cast up at http://asciicasts.com/episodes/221-subdomains-in-rails-3

I've set the :domain option to :all in session store:

Rails.application.config.session_store :cookie_store, :key => '_bloggit_session', :domain => :all

Now my users cannot logout.

Any ideas why? I've tried deleting all cookies and then trying again, etc.

I can login, and my session is carried across subdomains, but I can't logout.

I am using rails 3, and authlogic for authentication.

Thanks for any help!

1
Show us the relevant code, please? - Benoit Garret
It's just this one line in session_store.rb that's causing/not causing problems - >>> Rails.application.config.session_store :cookie_store, :key => '_bloggit_session', :domain => :all << - stringo0
Put it in your question then... - Benoit Garret
done, thanks for the heads up! - stringo0

1 Answers

1
votes

Specify the Domain.

I had the exact same issue and the culprit was using :domain => :all.

You'd think that would be all you need but it seems to cause some problems so I had to manually specify the domain with a preceding dot (.), like so:

:domain => '.lvh.me'

This fixed the issue in development. You can use different ways to set this in your various environments but I landed on something like this:

Rails.application.config.session_store :cookie_store, 
  :key => '_bloggit_session',
  :domain => { production:  '.bloggit.com',
               staging:     '.bloggitstaging.com',
               development: '.lvh.me' }.fetch(Rails.env.to_sym)