I've the following form that uses Simple_form gem:
<%= simple_form_for @match_prediction do |f| %>
<%= f.input :outcome, label: false, as: :radio_buttons, collection: [['local', match.local_team], ['Tie', 'Tie'], ['visit', match.visiting_team]], label_method: :second, value_method: :first %>
<%= f.submit 'Save' %>
<% end %>
Currently it works as expected, meaning: Renders 3 radio buttons, exclusive from each other and each resulting in a unique string being passed to the server.
The problem: I'd like to separate each of the radio buttons across different columns in a Bootstrap grid like below:
<div class="row prediction">
<div class="col-sm-4">
<!-- FIRST RADIO BUTTON HERE -->
</div>
<div class="col-sm-4">
<!-- SECOND RADIO BUTTON HERE -->
</div>
<div class="col-sm-4">
<!-- THIRD RADIO BUTTON HERE -->
</div>
<%= f.submit 'Save' %>
</div>
Since the whole collection is specified in one line within the form code, I can't simply split lines and insert them in the relevant HTML.
Is there a way to achieve this either via simple_form or vanilla rails form helpers?
I've considered splitting the radios as separate form inputs but this would allow to select more that one option at once. I'd appreciate your help.
<%= f.input :outcome, ... %>
? – assefamaru