开发者

Regular Expression Routes in Rails

开发者 https://www.devze.com 2023-01-02 15:06 出处:网络
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:

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)?开发者_如何学Go(/second)?"

Would match:

/first

/second

/first/second

But not:

/second/first

Is this possible? Thanks.


Updated to Rails 3 (now correctly supports REGEX routes).

0

精彩评论

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