Reputation: 11362
I am trying to create an action (:my_action) route that will allow me to capture the current object :id as well as a :client_id.
For new records, the url would look like this:
controller/action/new/my_action/:client_id
For editing existing records, the url would look like this:
controller/action/:id/edit/my_action/:client_id
I have played around with member routes but can't seem to get it working for both of the above scenarios.
Thanks in advance =]
Upvotes: 0
Views: 200
Reputation: 68046
You can easily declare two routes and direct them both to 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
Seems like the easiest solution to me.
Upvotes: 1