I'm printing a long horizontal list, which starts a new line when it reaches the end of its div, and objects are seperated by a comma:
<% Page.all.each_with_index do |p| %>
<%= p.name %>
<% if index + 1 < Page.count %>
 -&nsbp
<% end %>
<% end %>
Right now, it prints like this if Page.count == 18
:
page - page - page - page - page - page -
page - page - page - page - page - page -
page - page - page - page - page - page
so there is an ugly delimiter at the end of all but the last lines. Is there a way to prevent the delimiter from being printed if the end of the div is reached, so it would print like this?
page - page - page - page - page - page
page - page - page - page - page - page
page - page - page - page - page - page