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:

  <% @portfolios.each do |portfolio| %>
    <li style="z-index: 2;"><%= link_to, portfolio_path(portfolio) %></li>
  <% end %>

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.

Need Your Help

How to toggle admob view from MainViewController using Cordova

iphone admob cordova phonegap-plugins

I have implemented admob in my iPhone app, but the view which was created should be toggled based on my javascript's condition. So, i need to toggle that view using cordova plugins. Is there any

Best practices method of implementing a django OR query from an iterable?

python django django-models

I am implementing a one off data importer where I need to search for existing slugs. The slugs are in an array. What is the accepted best practices way of converting an array to an OR query?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.