Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的主应用程序包含我的页面控制器。这只是我将所有静态页面保存在一个位置的一种快速方法。
我有一个子应用程序将使用相同的布局(现在复制和粘贴)。布局使用 url_for(:pages, :about) 访问 /about
但是,这在子应用程序中不起作用,因为页面控制器不存在。
如何使用 url_for 以便我没有硬编码路径,以防我稍后更改映射?
有没有办法说
url_for(:project, :controller, :action)
sub 是否具有公开顶级项目的父属性?
你可以直接调用它:
OtherApp.url(:controller, :action)