Recurly JS 在发布时删除会话数据
我正在我的 Rails 应用程序上设置 Recurly JS。为了访问 current_order 或 current_user,我将它们的 id 存储在会话中。然而,当 Recurly JS 发布到我的“成功”路径时,所有这些数据都将从我的会话中删除。我可以通过这样做手动确保这些数据存在:
update_checkout_url("payment", :order_id => session[:order_id], :user_id => current_user.id)
但这看起来不太合理。这是某种 csrf 问题吗?或者在循环发布时是否无法保持这些数据的持久性?
I'm setting up Recurly JS on my rails app. To access the current_order or current_user I store their ids within the session. However, when Recurly JS is posting to my 'success' path, all this data is getting stripped out of my session. I can manually make sure this data is there by doing this:
update_checkout_url("payment", :order_id => session[:order_id], :user_id => current_user.id)
But this doesn't seem very railsy. Is this some sort of csrf issue? Or is it just not possible to keep this data persistent when posting to recurly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了同样的问题,在 recuryly google 小组的帮助下,我发现这是一个带有 Rails 保护的 csrf 东西。我将以下内容添加到我的控制器并指定了操作。
protected_from_forgery:除了=>; : 成功
这解决了问题。希望这对其他人有帮助。
I had this same problem and with the help of the recuryly google group, I found that it was a csrf thing with rails protection. I added the following to my controller and specified the action.
protect_from_forgery :except => :successful
This took care of the problem. Hopefull this will help someone else.