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 }
精彩评论