I don't even know how to ask this correctly, so pardon me if my question is confusing. I have a Table called Colors -
I would like to iterate a list of all the colors in the table, but presorted by 'color-family' so the result would look something like this:
Colors:
Reds -
Maroon
Stop Sign
Yellows -
Canary
Blues -
Sky Blue
Royal Blue
Greens -
Neon Green
But I have no idea the sql syntax to collect and sort that kind of information.
Surprisingly, this code didn't work ;)
<% @group = Colors.presort_by("color-family") %>
<% @color = Colors.all %>
<% @group.each do |group| %>
<%= group.color-family %>s - <br>
<% if @[email protected] %>
<%= @color.name %>
<% end %>
<% end %>
lol. As you can see, I have no real idea where to start. Any help would be greatly appreciated. I don't have any sql query experience whatsoever.
Thanks again!

@colors = Color.order(:color-family ,:name)something like this, depends what order you want. You could reference here