Listing a model in a drop down menu its submenu
I have a model named Portfolio. I list all the Portfolios I created on my page in a drop down menu like this:
<ul> <% @portfolios.each do |portfolio| %> <li style="z-index: 2;"><%= link_to portfolio.name, portfolio_path(portfolio) %></li> <% end %> </ul>
I have three Portfolios in the drop down menu: Advertising, Graphic Design, Web Development. Then I also have a menu item called Photography which opens up a sub-menu of Portrait, Landscape, and Editorial. So Advertising, Graphic Design, Web Development, Portrait, Landscape, Editorial are all models of Portfolio. Photography is just there to facilitate a sub-menu for Portrait, Landscape, and Editorial. I'm not really sure how to set this up. Should I create a new model named something like Photography_Portfolio? And how do I create the Photography menu item if it's not a Portfolio?
What are you storing in the Portfolio model? I would probably just hard code the menu. Depending on the use case I would hard code the Top level menu items and pull in the different portfolios in the drop down menu, you could, for example, create different scopes for the different types.