Rails:从请求中提取原始 url [英] Rails: Extracting the raw url from the request
问题描述
我正在使用 Rails 2.2.
I am working with Rails 2.2.
所需的行为如下:
我有一个链接(嵌入了 ajax 链接)
I have a link(with a ajax link embedded)
xyz.com/admin#page1
xyz.com/admin#page1
当我进入上述页面时,如果我没有登录,我应该被重定向到登录页面.
When I go to the above page, I should be redirected to the login page, if I am not logged in.
登录后,我应该被带回
xyz.com/admin#page1
xyz.com/admin#page1
为此,我需要在访问任何页面时将 url 存储在会话中.
For this I need to store the url in session when I visit any page.
问题是当我做 request.uri 时,我得到xyz.com/admin
The problem is that when I do request.uri, I get xyz.com/admin
但是我想存储xyz.com/admin#page1
But I want to store xyz.com/admin#page1
问候,潘卡伊
推荐答案
# params 不发送到服务器,所以如果你想存储 # params 你应该 在javascript中保存到cookies
# params don't send to server, so if you want to store # params you should save it in javascript to cookies
这篇关于Rails:从请求中提取原始 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!