我正在尝试创建一个动作(:my_action )路由,这将允许我捕获当前对象:id以及a:client_id。
对于新记录,网址如下所示:
controller/action/new/my_action/:client_id
要编辑现有记录,网址将如下所示:
controller/action/:id/edit/my_action/:client_id
我玩过会员路线,但似乎无法让它适用于上述两种情况。
提前致谢=]
答案 0 :(得分:1)
您可以轻松声明两条路线并将它们都指向my_action
map.connect 'controller/action/new/my_action/:client_id', :controller => :my_controller, :action => :my_action
map.connect 'controller/action/:id/edit/my_action/:client_id', :controller => :my_controller, :action => :my_action
对我来说似乎是最简单的解决方案。