I recently posted this on the ruby group instead of here
but here is what I am attempting to do.
I am building a site, and I wish to populate the navigation dynamically
from a MySQL db table, and the page content from a different table.
The idea being I can have the navigation on every page, and use
different controllers to select different content depending on what is
The Event page content comes from a page table where id = someValue
but I also need some events (days out etc, presentations), they come
from the events table.
I am confused how to put all the pieces together in one page.
Could anyone point me in the right direction?
At the moment I have a Site Controller, NavItem controller/model (with
a partial _nav_item), Event controller/model and Page controller/model,
all of which have the functions for list/show etc inside their
respective controller, except the Site.
Since I posted I have created a partial for my nav_items, but how do I
then render my partial in another controller? I can’t understand how I
could just use
<%= render :partial => “nav_item”, object => @nav_item %>
and rails know what “nav_item” is.
Should I be looking at using a template?
If someone could provide some clarification on what I am doing wrong,
or if I am trying to structure it wrong, that would be great