more than 1 route that contains the same number of arguments?
On Feb 23, 6:14 am, koloa [email protected] wrote:
more than 1 route that contains the same number of arguments?
I think you mean if you have two routes like this:
/:arg1/:arg2/:id
/:arg3/:arg4/:id
then yes Rails needs some why to differentiate these like:
/foo/:arg1/:arg2/:id
/bar/:arg3/:arg4/:id
But don’t forget that you can also differentiate with regex patterns
if your args are distinguishable by pattern like
/:arg1/:arg2/:id :requirements => { :arg1 => /\d[A-Z]\d/ }
/:arg3/:arg4/:id :requirements => { :arg3 => /[a-z]\d[a-z]/ }
The first would match something like ‘/2D4/anything/12’ and the second
would match ‘/a5d/anything/12’ and could be routed different ways.