views:

10

answers:

1

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 =]

+1  A: 

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.

Nikita Rybak
This is exactly what I was after. Thank you!
Coderama