Rails redirect_to 页面部分 [英] Rails redirect_to section of page

查看:42
本文介绍了Rails redirect_to 页面部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于普通重定向,它类似于 redirect_to root_path.

For a normal redirect it would be something like redirect_to root_path.

我将如何重定向到类似:localhost:3000/#contact.我不仅要重定向到 root,还想重定向到 root,还要重定向到根页面的联系部分.

How would I redirect to something like: localhost:3000/#contact. Instead of just redirecting to root, i want to redirect to root but also to the contact section of the root page.

这可能吗?

推荐答案

这应该有效:

redirect_to root_path(anchor: 'contact')

这篇关于Rails redirect_to 页面部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆