ruby on rails - Convention of member routes with parameters? -


I'm trying to create an action (: my_action ) path that captures me Will allow current objects: IDs as well as: Client_ID.

For new records, the URL will look like this:

  Administrator / verb / new / my_action /: client_id  

existing records To edit, the URL will look like this:

  Administrator / Action /: id / edit / my_action /: client_id  

But it can not seem to work in both circumstances.

Thanks in advance =]

You can easily declare two routes And can direct them to my_action

  map .connect 'controller / verb / new / my_action /: client_id' ,: admin = & gt; : My_controller ,: action = & gt; : My_action map.connect 'Controller / Action /: id / edit / my_action /: client_id',: admin = & gt; : My_controller ,: action = & gt; : My_action  

Looks like the easiest solution for me.


Comments