How can I create a Rails 3 route that will match all requests and direct to one resource / page?

后端 未结 4 1589
粉色の甜心
粉色の甜心 2021-02-07 03:50

I have a rails app (Rails 3.0) that I need to temporarily take out of service. While this is in effect, I want to create a new route that will direct all requests to a single pi

4条回答
  •  [愿得一人]
    2021-02-07 04:28

    Rails needs to bind the url parameters to a variable, try this:

    match '*foo' => 'content#holding'
    

    If you also want to match /, use parenthesis to specify that foo is optional:

    match '(*foo)' => 'content#holding'
    

提交回复
热议问题