I have a model with many children (selections). I need to display the children using fields for but I really want to group them based on an attribute on each selection using group_by.
Currently I am using
accepts_nested_attributes_for :selections, :allow_destroy => true
So my form looks a bit like this:
<% form_for @match do |form| %>
<% form.fields_for :selections do |child_form| %>
<%= child_form.object.first_name %>
<%= child_form.check_box '_delete' %>
<%= child_form.label '_delete', 'Remove' %>
<% end %>
<%= form.submit %>
<% end %>
Not quite sure how I could group the :selections using group_by. Any advice?