11155
(-- --)
1
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: Module: Enumerable (Ruby 3.1.2) 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
11155
(-- --)
5
Walter Davis wrote in post #959491:
Have a look at the Enumerable class:
module Enumerable - RDoc Documentation
each_slice in particular looks likely what you need.
Walter
Thanks that worked