简体   繁体   中英

Regular Expression Routes in Rails

I am looking to create a rails route that is capable of accepting requests using a regular expression. Specifically, I need optional paths. As an example:

"(/first)?(/second)?"

Would match:

/first
/second
/first/second

But not:

/second/first

Is this possible? Thanks.

更新到Rails 3(现在正确支持REGEX路由)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM