如何向 Rails 中的每条路线添加内容?

发布于 2024-07-11 14:39:42 字数 234 浏览 5 评论 0原文

鉴于我已经指定了相当多的资源并且不想将所有资源重构到命名空间中,是否有一种简单的方法可以将永久字符串添加到 Rails 应用程序中的每个 路由中?

我可以按照以下方式做一些事情

map.root 'myappnamehere'

并将该字符串附加到所有路线的开头吗? 我意识到这不是我通常实现map.root 的方式。

TIA

Is there an easy way to add a permanent string to every route in a Rails app, given that I already have quite a few resources specified and don't want to refactor all into a namespace?

Can I do something along the lines of

map.root 'myappnamehere'

and have that string appended to the beginning of all routes? I realise that this is not how I implement map.root normally.

TIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文