简体   繁体   English

使用devise在Rails 3.1和2.3.12之间共享会话

[英]Sharing sessions between rails 3.1 and 2.3.12 using devise

I'm attempting to share sessions between a rails 3.1 app and rails 2.3.12 app. 我正在尝试在Rails 3.1应用程序和Rails 2.3.12应用程序之间共享会话。 The rails 3.1 app is a subdomain of the 2.3.12 app. rails 3.1应用程序是2.3.12应用程序的子域。 Both apps use devise for authentication (different versions for rails compatibility). 这两个应用程序均使用devise进行身份验证(不同版本的Rails兼容性)。

I've managed to get it working to the point where session variables are accessible from either app, but it fails after sign in. It seems the reason it fails is because session[:session_id] gets reset on sign in, leaving the other app with the old session_id. 我设法使它工作到可以从两个应用程序访问会话变量的程度,但是登录后失败。看来失败的原因是因为session[:session_id]在登录时被重置,从而离开了另一个应用程序与旧的session_id。

How can sessions continue to be shared after sign in? 登录后如何继续共享会话? I've attempted to prevent devise from resetting the session_id but couldn't see where that was happening. 我试图阻止设计者重置session_id,但看不到发生了什么。

Check the docs on Rails sessions specially "2.5 Session Storage". 检查有关Rails会话的文档,特别是“ 2.5 Session Storage”。

You need to save the sessions and probably you'll need to have the same keys on both applications. 您需要保存会话,并且可能需要在两个应用程序上具有相同的键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM