Rails 3 routing constraints don't seem to be matching the regex properly -


I am using Rail 3.0.5 and I have setup a route using a regedx constraint. This train used to work on 2.3.5, but it is not working in Rail 3. The route looks like this:

  get '/: version_id' = & gt; 'Paste #Shows',: Barriers = & gt; {: Version_id = & gt; / [\ D \ w] {40} /}   

This does not work at all, however, the following tasks:

  get '/: version_id '= & Gt; 'Paste #Shows',: Barriers = & gt; {: Version_id = & gt; /.{40}/} '/: version_id' = & gt; 'Paste #Shows',: Barriers = & gt; {: Version_id = & gt; / \ W {40} Get the '/: version_id' = & gt; 'Paste # show'   

Is there something wrong with the management of the railroad []? Or am I doing something wrong?

Version_ID usually looks something like this:

  816616001d7ce848944a9e0d71a5a22d3b546943    

I do not have any solution, why not work on another.

However, according to the PickX Book, \ W is actually a superset of \ d .

  \ w [a-za-z0-9 \ _] character of ASCII word \ d [0- 9] character of ASCII decimal digits   

Therefore, [\ d \ w] {40} is no different from \ w {40} , which works for you.

Comments