I am trying using a partial to render the application's menu, capitalizing the 'tab' using CSS, based on a local variable (tab):
<%= link_to "employees", jobs_path, :class => (tab=="employees" ? "selected":"unselected") %>
<a class="unselected">jobs</a>
<%= link_to "tags", tags_path, :class => (tab=="tags" ? "selected":"unselected") %>
The partial is embedded in the the Application's layout:
<body>
...
<!-- tab variable needs to be set in the view, not the layout -->
<%= render :partial => "layouts/primary_menu", :locals => { :tab => "profiles" } %>
...
</body>
Unfortunately, I need to set the variable's value in the view, but the variable isn't available. Should I be using the :content_for symbol instead of :locals?
At some point, I may want to pass a model instance variable to the partial, so the solution needs to be flexible.
Is there a better approach?