Route alias in Rails

后端 未结 3 1202
夕颜
夕颜 2020-12-08 13:15

I have a model stories in Rails 3.

I want to make an alias \"books\" for \"stories\" so I can have routes /books/192 instead of /stories/192

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 13:49

    That's why they made the path option on match which is also available on resources:

    resources :stories, :path => "books"
    

提交回复
热议问题