On May 18, 4:08 pm, PsiPro <[email protected]> wrote: > Hello, > > Nested routes are for prettier urls and better leaner controllers. If > you need to scope the controller based on what it is nested under its > not DRY code.
I'm not sure I understand what you mean by not DRY. Here is how my controller directory looks without namespaces/sub-directories: app/controllers/products_controller.rb app/controllers/discounts_controller.rb app/controllers/promotions_controller.rb . . app/controllers/expirations_controller.rb app/controllers/coupons_controller.rb apart from products controller, each of the controllers listed manages a resource with some relation to the Product model. Either it's an associated model (Coupon) or it's a resource that manipulates Product in some way (e.g. products/14/expirations/create calls @prouduct.expire!). Each resource needs to load the associated parent for things like authorisation, so I think a parent/child setup is valid. previously, 'discount', 'promote', 'expire' etc were all extra actions in the products controller. They now have their own controllers, but I have 60+ controllers each handling different resources. As you can imagine, this is making the controllers directory a little unwieldy and I'm looking for a way to better organise the controllers to make them easier to find. In the case of nested resources, grouping by the name of the parent resource seems like a logical approach. How is scoping based on the parent any less DRY than having no scope? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

