前提:不能用安装其他gem包。如:mechanize
必须单独使用ruby来获取当前网页的地址。
controller里直接这样:[code="ruby"]request.request_uri[/code]
[code="Rails Console"]
app.get("main/index")=> 200app.request.request_uri=> "/main/index"[/code]
app.get("main/index")=> 200app.request.request_uri=> "/main/index"
[/code]