Routing nested resources in Rails 3

后端 未结 5 618
無奈伤痛
無奈伤痛 2020-12-07 20:51

I have a pretty common case for nested routes, I feel like, that looks something like this (in some sort of pseudonotation):

\'/:username/photos\' => Show         


        
5条回答
  •  悲哀的现实
    2020-12-07 21:17

    The best way to do this depends on the application, but in my case it is certainly Option B. Using namespaced routes I'm able to use a module to keep different concerns separated out into different controllers in a very clean way. I'm also using a namespace-specific controller to add shared functionality to all controllers in a particular namespace (adding, for example, a before_filter to check for authentication and permission for all resources in the namespace).

提交回复
热议问题