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

-- 
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.

Reply via email to