I have an array of AR objects that I’ve been able to sort alphabetically that I need to split by letter, for example { :a => [apple], :b => [banana] } and so on, based on an attribute that I use for sorting.
The end result should be something like
<ul>
<li>A</li>
<ul>
<li> Apple </li>
</ul>
<li>B</li>
<ul>
<li> Banana </li>
and so on.
I have no idea how to do this…
The array is already sorted alphabetically using the DB.
Can someone help me?
ngw
1 Answer