rails singular resource still plural?

前端 未结 4 565
天涯浪人
天涯浪人 2021-01-31 15:22

I have a search route which I would like to make singular but when I specify a singular route it still makes plural controller routes, is this how it\'s supposed to be?

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-31 16:11

    Yes, that's how it's supposed to be. Quote from the Rails Guide on Routing:

    Because you might want to use the same controller for a singular route (/account) and a plural route (/accounts/45), singular resources map to plural controllers.

    http://edgeguides.rubyonrails.org/routing.html#singular-resources

提交回复
热议问题