开发者

whats the difference between map.resources and map.resource

开发者 https://www.devze.com 2023-02-21 01:29 出处:网络
Hi Could any one let me know the difference. Thanks in Advanc开发者_如何学Ce-- Vam.resource will create a singluar resource i.e. all the routes of resources but without index.

Hi Could any one let me know the difference.

Thanks in Advanc开发者_如何学Ce-- Vam.


resource will create a singluar resource i.e. all the routes of resources but without index.

It's useful for things like "account".


Here's an explanation from the official Ruby on Rails guides:

  • Resource Routing: the Rails Default
  • Singular Resources


One is plural, one is singular. Good example on http://guides.rubyonrails.org/routing.html#singular-resources

Basically if your representing something which has more than one possible URL - i.e. you can look up multiple different books or authors, use map.resources. If you want to just look up a singular resource. For example the current user or the one and only Admin page, use map.resource

0

精彩评论

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