0

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 %>
    &nbsp-&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
Joe Morano
  • 1,715
  • 10
  • 50
  • 114

1 Answers1

0

No, there's no way to control that without actually making the lines wrap yourself, eg. by having new divs for each row.

smathy
  • 26,283
  • 5
  • 48
  • 68