whats the difference between map.resources and map.resource
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
精彩评论