在 Ruby on Rails 中,无法渲染 :controller => “通用”,:action => “top_pages”但需要使用 :template => “通用/top_pages”?

发布于 2024-09-24 05:56:26 字数 91 浏览 0 评论 0原文

似乎 :controller 选项没有做任何事情?指定整个路径不会比使用 :controller 指定级别低一点吗?

it seems that the :controller option doesn't do anything? Won't specifying the whole path be a little bit lower level than specifying using :controller?

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

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

发布评论

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

评论(1

意犹 2024-10-01 05:56:26

据我所知,我检查了 文档,没有 :controller 选项,我认为它被忽略了。

另外,我相信这是一个更短的符号。如果你比较

:template => 'controller/action'

:controller => 'controller', :action => 'action'

明显(至少对我来说)它具有相同的含义。
此外,这更通用,因为有时控制器(和视图)是嵌套的。

To my knowledge, i checked the documentation, there is no :controller option, and i think it is just ignored.

Also, i believe it is a shorter notation. If you compare

:template => 'controller/action'

with

:controller => 'controller', :action => 'action'

It is pretty obvious (at least to me) that it has the same meaning.
Also, this is more generic, because sometimes controllers (and views) are nested.

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