What is the best way to display group data?
Currently in my controller I have:
@items = Item.order("group_name")
Then in my view I can iterate through it:
- @items.each do |item|
%p= item.name
What would be the cleanest and most efficient approach to produce something like this:
<strong>Group Name 1</strong>
<p>Item 1</p>
<p>Item 2</p>
<strong>Group Name 2</strong>
<p>Item 1</p>
Controller
Model
View