标签: ruby-on-rails rails-routing
默认情况下,resources命令会将new操作的网址生成为{model}/new。根据文档,发送path_names = {}哈希不会更改基础{model}。如何将/submit路由到posts#new行动?
new
{model}/new
path_names = {}
{model}
/submit
posts#new
答案 0 :(得分:2)
match 'submit' => 'posts#new'
我希望这就是你要找的......
如果你想了解它在场景背后是如何运作的话,你可能想看看Ryan Bates的那两个精彩的截屏视频。
routing-walkthrough routing-walkthrough-part-2