Rails 3.2.8 - 分享与POW的子域的设计会话 [英] Rails 3.2.8 - Share Devise Sessions Across Subdomains with POW
问题描述
我正试图在rails 3.2.8中设置一个简单的基于子域的博客。基本上它将具有网站,用户(通过Devise进行身份验证),以及会员资格以将用户连接到网站。我设置了POW,使myapp.dev正常工作。每个站点都有一个子域名,我可以使用子站点导航到site#show操作,没有任何问题。我的问题是我无法让Devise会话跨子域共享。一切都在我的heroku应用程序工作正常,但我想能够在本地测试。
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.
当我将以下内容添加到session_store.rb中时,会话似乎在子域中工作,但是我无法注销。
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
当我将结束更改为域:.appname.dev 它不起作用。
When I change the end to domain: ".appname.dev" it doesn't work.
任何帮助将不胜感激!
推荐答案
确保清除您的Cookie并重新启动应用程序。
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
是域选项的正确格式。开始时间很重要。
domain: ".appname.dev"
is the correct format for the domain option. The beginning period is important.
这篇关于Rails 3.2.8 - 分享与POW的子域的设计会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!