Rails routes with wildcard and requirements -


I need to set up routes that will match:

  1: Fixed / 9731-Monday-Tuesday-Wednesday-Thursday-Friday / 9 22-second 2: Fixed / Potato   

In the first case there are unlimited parameters, although all of them are in the format [Number] - [some-string]. In the second case there is only one parameter with the factor.

I'v tried this:

  map.connect ("/ fixed / * param_list" ,: controller => 'first' ,: verb = & Gt; 'index',: requirements => {: param_list = & gt; / (\ d + - [\ w -] +) /}) map.connect ("/ fixed / category"   

However with the requirement, the first route does not work much more with the wildcard. It only matches the variant like / fixed / 922-second , but two more Not more dimensional / fixed / 9 22-second / 123-and not more .

So my question is: Or is it possible to parametricize the wildcard path through requirement and how to set it up in my case.

It seems that your regexp is wrong.To handle many parameters, it / \ d + - [\ w -] + (\ / \ d + - [\ w -] +) * / ?

Comments