简体   繁体   中英

Redirect_to :back stops working after refreshing page in Rails 5.0

我正在使用redirect_to :back转到ruby on rails项目中的上一页,但是当我刷新该页面后,它不再起作用了,我们如何保留存储在其中的上一页URL。

You can save your last page in session.

session[:return_to] ||= request.referer

And instead redirect_to :back , put this:

redirect_to session[:return_to]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM