The navigation for my site is obviously stored in the application layout file. Part of that navigation is driven by the database. How to I render a partial in the layout and pass in the collection of objects for it to render?
EDIT:
I think my question revolves more around how to get data into the partial, is that done form the application controller or do I have to add the data in each action on each controller?
If you just wish to pass one object in then you can use the
objectkey onrender. The passed object will be accessible as an local variable of the same name as the partial. SO if the partial is callednavigationthe local variable will benavigation.In the partial:
If you wish to pass multiple objects then you can use the
localskey. The names of the local variables in your layout are then the keys of the passed hash.In the partial: