Rails 3 资源功能中自定义一条路线
默认情况下,resources 命令生成 new
操作的 url 作为 {model}/new
。根据文档,发送 path_names = {}
哈希不会更改基本 {model}
。我将如何将 /submit
路由到 posts#new
操作?
By default the resources command generates the url for new
action as {model}/new
. Sending a path_names = {}
hash doesn't change the base {model}
according to the documentation. How would I go about routing /submit
to posts#new
action?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我希望这就是您正在寻找的...
如果您想了解它在幕后的工作原理,您可能想看看 Ryan Bates 的两个精彩截屏视频。
路由演练 路由-walkthrough-part-2
I hope this is what you are looking for...
You might want to have a look at those two awesome screencasts by Ryan Bates if you wish to understand how it works behind the scene.
routing-walkthrough routing-walkthrough-part-2