Well, first off, nested <ul> is not valid XHTML, so you're better off using CSS class to differentiate the nested level of various <li> items. That will also simplify the Ruby code (no need to create recursive functions).
iterate that structure to create your <li> lines, and use css to create the indent pattern you need.
<ul>
<% products_menu.each do |nav_item| -%>
'<li id="' + nav_item[:id] + '" class="' + nav_item[:class]...etc
<% end %>
</ul>
Of course, that could be written as a general purpose helper so you don't have so much messy logic in the view file, but rather something simple like this:
is perfectly legal. I think it's better too, because it reflects the menu logic, renders well without a stylesheet and allows for easy collapsing/expanding of subtrees. You can still have a flat representation in the database, that's a matter of taste.