Showing a menu from an array


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

This is my code:

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

Any suggestions?

You might find this useful, =>

And I bet you could implement something like the following:

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

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