I have the following in routes.rb
map.resources :districts do |district|
district.resources :circuits, :name_prefix => ‘district_’
I want full CRUD for circuits at /circuits but only partial CRUD at
/districts/?/circuits (index and new). This is to avoid too many levels
of nesting (there are several more to come).
I have got this fine for the UI (the links take you around exactly as I
want). But the extra urls are still available.
How do I detect in the controller show if the url is
/districts/1/circuits/1 which I want to redirect to the un-nested
version at /circuits/1 ?
How do I know in index of controller whether I am
/districts/1/circuits (limit to only district 1) or /circuits (list
I guess it will be fairly obvious that I am pretty much a rails newbie.
But I have looked in the Agile bk 2nd ed and as many articles on nested
resources as I can find.