Display an array into multiple columns in a view

I have an array "$a" and the below code in my view displays all the
elements in a single column. How do I display them into 5 columns?

I am not sure if it should be done thru ruby code, or html tags or CSS.
Please suggest. thanks

<ul>
<% for w in $a %>
<%= w %>
<% end %>
</ul>

Have a look at the Enumerable class: http://ruby-doc.org/core/classes/Enumerable.html each_slice in particular looks likely what you need.

Walter

This is more of a CSS issue. Style your

  • 's as floated. Or you can just drop them in a .
  • You may want to look into using a partial with a collection

    Walter Davis wrote in post #959491:

    Have a look at the Enumerable class:
    http://ruby-doc.org/core/classes/Enumerable.html
      each_slice in particular looks likely what you need.

    Walter

    Thanks that worked