Rails 3获取请求引用 [英] Rails 3 get request referrer
本文介绍了Rails 3获取请求引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
http: //mysite.com/article/5?type=blah
在重定向登录页面中,我需要
解决方案
您可以使用 request.referer
或 request.env ['HTTP_REFERER']
在您的控制器中获取引荐网址。
I'm using Rails 3.0.9, Ruby 1.9.2, Devise 1.3.4 and has a need in Devise session new view to access the request url parameters although I see this as a general Rails request handling question. Essentially, a request is made to a Devise authenticated resource which redirects the user to the login screen. In the login view, I need access to the request url, eg, this is the request url called in the beginning
http://mysite.com/article/5?type=blah
In the redirect login page, I need access to that URL, anyone know how I can do this?
解决方案
You can use request.referer
or request.env['HTTP_REFERER']
in your controller to get the referer url.
这篇关于Rails 3获取请求引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文