How can I display results from an object into columns like the following:
<ul>
<li><a href="#">Category name</a></li>
<li><a href="#">Category name</a></li>
<li><a href="#">Category name</a></li>
</ul>
<ul>
<li><a href="#">Category name</a></li>
<li><a href="#">Category name</a></li>
<li><a href="#">Category name</a></li>
</ul>
<ul>
<li><a href="#">Category name</a></li>
<li><a href="#">Category name</a></li>
<li><a href="#">Category name</a></li>
</ul>
Regardless of results returned to @categories = Category.all I want to divide them up into three columns like this. What’s the best way programmatically to do it?
each_slice method can help you
In HAML, you can handle it by this way