Rails 3:外部链接上的 before_filter
我不知道我的想法是否正确。
在我的 Rails 应用程序中,我使用 Omniauth 进行 facebook 身份验证。
我有 2 个不同的链接“登录”(它们都以 auth/facebook 为目标,并带有回调身份验证/创建)。一个应该重定向到用户个人资料(用户/节目),另一个应该重定向到帖子创建(帖子/新)。
我认为一个好方法是在用户单击“登录”链接之一时存储路径(用户/显示)或(帖子/新),然后在身份验证/创建方法上重定向到此路径。我想到了“auth/facebook”上的 before_filter 。
但 auth/facebook 是 facebook 的外部链接,而不是常规操作。那么我该怎么做呢?
I don't know if I'm thinking the right way or not.
In my rails app, I use facebook authentication with Omniauth.
I have 2 different links "Sign In" (both of them target to auth/facebook with callback authentications/create). One should redirect to the user profile (users/show) and the other one to a post creation (posts/new).
I think a good way to do that is to store the path (users/show) or (posts/new) when the user is clicking on one of the "sign in" links, and then redirect to this path on authentications/create method. I thought about before_filter on "auth/facebook".
But auth/facebook is an external link to facebook and not a regular action. So how can I do that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能会尝试在 auth/facebook 的会话中存储“final_destination”变量。
您必须将其存储在变量中,因为身份验证/创建可能会使用会话来登录您。
在创建的操作结束后:
或
I might try storing a "final_destination" variable in the session in auth/facebook.
You would have to store it in a variable because authentications/create is probably going use the session to log you in.
After the end of the created action:
or