【发布时间】:2014-08-03 19:09:31
【问题描述】:
我有一个家庭控制器,我打算将其仅用于诸如 aboutus、contactus 或登录页面等页面。将其包含在路由文件中的最佳方法是什么,我根本没有得到默认路由但请务必从站点的根目录以 /[action] 的形式访问每个操作。
例如:
xyz.com/aboutus should take me to home#aboutus
xyz.com/contactus should take me to home#contactus
等等
【问题讨论】:
-
在路由中使用 'as: path_name' 属性。
-
你在寻找类似
get '/patients/:id', to: 'patients#show'的东西吗? -
我认为我的问题措辞不正确。我希望能够让 xyz.com/aboutus 在 home 控制器下显示 aboutus 操作的内容。
标签: ruby-on-rails routes