开发者

How to create a conditional route

how can I create a conditional route that work for the following:

http://site.com/1vcs1YUf1Z

Where 1vcs1YUf1Z is a UID.

Is there a way I can add a routing option to the end of my route file that says if the following condition is met (10 characters trailing the first / and that's it) then to route to the开发者_开发百科 following and pass that as the UID?

Thanks


get 'projects/:uid' => 'controller#action',
  :constraints => { :uid => /^[0-9a-z]{10}$/i }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜