Skip to content

Instantly share code, notes, and snippets.

@wolfravenous
Created September 21, 2016 16:08
Show Gist options
  • Save wolfravenous/9917870d67982c5979976b550a776fea to your computer and use it in GitHub Desktop.
Save wolfravenous/9917870d67982c5979976b550a776fea to your computer and use it in GitHub Desktop.
Scenario: two selectors both with days. User chooses Tuesday in one, Friday in the other. I need to assemble the days Tuesday through Friday as an array and display them all in the view. I store the selection data as first_day_id and last_day_id, but I can not figure out or find an example of how to assemble them as an array for the view.
<%= simple_form_for(report) do |f| %>
<%= f.input :first_day_id, collection: Week.all, as: :grouped_select, group_method: :days %>
<%= f.input :last_day_id, collection: Week.all, as: :grouped_select, group_method: :days %>
<%= f.button :submit, class: "btn-primary" %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment