Hello all
As I adopt REST more and more, my app has grown to have a lot of nested routes - only nested one level deep - that are starting to get a bit cumbersome to manage. e.g.
resources :products do resource :promotion resource :discount # etc end
each nested resource has it's own controller. I'd like to group to controllers so I used the :module option on each nested resource and created a namespaced controller. e.g.
resources :products do resource :discount, :module => :product end
This works fine, and the controller happily lives under controllers/ product/discounts_controller.rb
However, a few of the libraries and gems I use don't cope so well with namespaces, especially when the associated model isn't also namespaced. To get around this, I've added 'app/controllers/products' as a load path in environment.rb and I've also added that path to the view paths for relevant (nested) controllers.
This has worked great so far and I my tests are passing. I was just wondering if anyone would caution against this approach? I'm generally quite cautious about changing defaults and expected conventions!
many thanks John