Rails - 重定向回来,除非上一页是艺术家页面
我想重定向回上一页,除非上一页是我的“艺术家”控制器的“显示”操作。
所以我想它看起来像:
if *previous page was artist show*
redirect_to [track.artist, track]
else
redirect_to :back
end
我的问题是 - 如何测试上一页是否是我的艺术家控制器的显示操作..?
I'd like to redirect back to the previous page, UNLESS the previous page was my 'artist' controller's 'show' action.
So I guess it would look something like:
if *previous page was artist show*
redirect_to [track.artist, track]
else
redirect_to :back
end
My question is - how do I test if the previous page was my artist controller's show action..?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许
request.referer
就是您正在寻找的内容?然后你可以这样说:Perhaps
request.referer
is what you're looking for? Then you can say something like: