简体   繁体   English

Rails应用程序无法启动会话

[英]Rails application failing to start session

This is a really strange issue I am running into. 这是我遇到的一个非常奇怪的问题。 When I start my rails app and go to 0.0.0.0:3000 and open the console when I try to set a cookie - 当我启动Rails应用并转到0.0.0.0:3000并尝试设置Cookie时打开控制台-

cookies[:foo] = "bar"

I can log it out using pry, but when I check the resources tab or try to access the cookie nothing is getting set. 我可以使用pry登出,但是当我检查“资源”选项卡或尝试访问cookie时,没有任何设置。

To test and ensure things I made a new project and started it up, upon visiting a page and checking the resources tab I see that the session gets set right away. 为了测试并确保一切,我创建了一个新项目并启动了该项目,在访问页面并检查“资源”选项卡后,我看到该会话已立即设置。

Any ideas on what could cause the session to fail starting? 关于可能导致会话启动失败的任何想法?

So after going through my gem file and going through each gem. 因此,在浏览完我的gem文件并浏览了每个gem之后。 The answer was 'Rails-Api' gem. 答案是“ Rails-Api”宝石。 Seems to block all session and cookies. 似乎阻止了所有会话和cookie。 By removing that everything works again. 删除后,一切都会恢复正常。

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

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