Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top