On Thu, Aug 16, 2012 at 3:27 PM, mack3000 <[email protected]> wrote:

> So if the top navigation is
>
> - Home
> www.example.com/
>
> - About
> www.example.com/about
...
> www.example.com/about/history
...
> Would I need to create a new controller for each page category?

The immediately obvious ways that leap to my mind are either that, or
manual routing to different controllers.  They should all be pretty
trivial boilerplate, though, so it shouldn't be too hard.  I wouldn't
be surprised if there is (or someone could whip up) a gem to make this
even easier....

> I currently have the top level navigation all done under 1 controller
> (static_pages_controller.rb) & the routes.rb (match '/about', to:
> 'static_pages#about').
>
> So I am trying to figure out how I would add the subpages for about
> (history, location, careers) so they the url www.example.com/about/history
> etc.

Without  a lot of manual routing, off the top of my head, I'd say:

- Make each top-level page its own controller, including an index action
- Make each sub-page a new action within that controller

So for instance you'd have an "about" controller, with actions
including index (for /about), history (for /about/history), etc., and
a "support" controller, with actions including index (for /support),
products (for /support/products), and so on.

Or you could put them all in one controller, with more explicit manual
routing in routes.rb for the index actions.

-Dave

-- 
Dave Aronson, Available Secret-Cleared Ruby/Rails Freelancer (VA/DC/Remote);
see www.DaveAronson.com, www.Codosaur.us, and www.Dare2XL.com for more info.

-- 
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 https://groups.google.com/groups/opt_out.


Reply via email to