简体   繁体   中英

How to return to previous URL after clicking on “Back” button in Rails

I'm using simple_calendar in my Ruby on Rails project and I'm having a problem.

When I see "February" my URL looks like this:

localhost:3000/meetings?start_date=2016-02-07

After I "Edit" an event, I am redirected to the "Show" page of that event where I have a "Back" button. When pressing that button, I'd like to return to the same month's URL I was at before. Instead of that, I return to:

localhost:3000/meetings

How do I return to the first URL?

这就像一个魅力:

<%= link_to 'Back', url_for(:back) %>

我认为你可以使用request.referer作为“后退”按钮的URL。

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