It sounds like it is generally recommended either not to nest controllers at 
all or at most by one level. However this seems to relate mostly to 
resources. Interactive functionality generally works well with resources, 
but for a complete website there is often additional content that contains 
information not suitable for resources, but that still uses the same views 
mechanism for consistency.

I've got some resources and also some content that doesn't suit using 
resources and it is convenient to store the content in hierarchical 
directories (?namespaces). The content is written as rails views. All worked 
OK under rails 2 but I'm struggling to get routing to work under rails 3.

For example if you have an app/views directory structure such as:

views >
  level1
    level2
      level3

and would to place views at each of these levels, including an index action, 
what is the best way to create route(s) in routes.rb to accommodate this?

Using the default wildcard route of match 
':controller(/:action(/:id(.:format)))' results in the top level working but 
the index action for level2 results in an action not known for level1 
controller from the router.

I've experiemented with various combinations of namespace, scope and match 
statements, but none seem to cater for this seemingly simple requirement to 
match a nested set of views to urls.

Maybe I'm missing a trick here - is there a better way to structure 
hierarchical non-resource content but still use the facilities in the rails 
framework? I guess I could combine rails with some other framework, but 
would like to keep everything within rails if possible.

Any suggestions greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/rYPDjSBOxycJ.
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