Rails 具有特定字符的路由

Rails routes with specific character

我有以下 url 请求类型,其中包含 # 个字符

http://localhost:3000#user-name

我想配HomeController#show_user,路由怎么写?

来自Uniform Resource Locators (URL)

The character "#" is unsafe and should always be encoded because it is used in World Wide Web and in other systems to delimit a URL from a fragment/anchor identifier that might follow it.

您不能在 url 中使用 # 符号,因为它是保留字符。

你可能见过这样的符号用法

https://www.google.com/search?q=hello+world#brs

但是这个符号在这里用作片段分隔符。