5
votes

I am trying to set up a simple subdomain-based blog in rails 3.2.8. Basically it will have sites, users (authenticated through Devise), and memberships to connect users to sites. I set up POW so that myapp.dev is working properly. Each site has a subdomain and I can navigate to the site#show action using the subdomains with no problems. My issue is that I can't get the Devise sessions to be shared across subdomains. Everything is working fine on my heroku app, but I would like to be able to test this locally.

When I add the following to session_store.rb, teh sessions seem to work across subdomains, but then I can't log out.

Appname::Application.config.session_store :cookie_store, :key => '_appname_session', domain: :all

When I change the end to domain: ".appname.dev" it doesn't work.

Any help would be greatly appreciated!

1
I'm not sure how this would help. Isn't Devise based on Warden? Can you provide details on why it isn't working currently and how using Warden directly would help solve the issue? - dvanderb
It seems to be working now. I believe I had to either restart the server or clear my cookies, although I thought I had done that. I will have to double-check, but I think the domain option is set to domain: :all in the session store file. - dvanderb

1 Answers

5
votes

Make sure you clear your cookies and restart the app.

Appname::Application.config.session_store :cookie_store, :key => '_appname_session', domain: ".appname.dev"

domain: ".appname.dev" is the correct format for the domain option. The beginning period is important.