Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个非常简单的用例:-
如果“角色”的删除请求来自“users/show”,则删除该角色并重定向到 users_show
如果“角色”的删除请求来自“xyz/show”,则删除该角色并重定向到 xyz_show
我不想通过 link_to 传递参数,还有其他方法可以实现吗?
尝试
redirect_to request.env['HTTP_REFERER']
见http://apidock.com/rails/ActionController/Base/redirect_to