Showing a menu from an array

Hi,

I want to show a menu on my page. The menu items are fetched from an
array called menu_pages.

What I would like to accomplish is this -> blog | photos | movies

I’m using “|” in my view as a separator. The problem is that my
current solution shows blog | photos | movies |… The last “|” is
obsolete.

This is my code:

    <% for page in @menu_pages %>
  • <%=page%>
  • <% if @menu_pages.next %> | <% end %> <% end %>

Any suggestions?

You might find this useful, =>
http://www.igvita.com/blog/2007/03/15/block-helpers-and-dry-views-in-rails/

And I bet you could implement something like the following:

<% menu_for @menu_pages do|menu| %>
menu.page
<% end %>

Although, for menus you might, not need to allow customization of each
menu
element…

Todd