Q:

convert html code of radiobutton using rails helpers

How can I achieve the below radiobutton in html using rails helpers?? I do have a field guests in my database where the selected value of the radio button gets stored.
<div class="segmented-control" style="width: 100%; color: #5FBAAC">
            <input type="radio" name="guests" id="1">
            <input type="radio" name="guests" id="2">
            <input type="radio" name="guests" id="3">
            <input type="radio" name="guests" id="4">
            <input type="radio" name="guests" id="5">
            <input type="radio" name="guests" id="6">

            <label for="1"  data-value="1">1</label>
            <label for="2" data-value="2">2</label>
            <label for="3" data-value="3">3</label>
            <label for="4"  data-value="4">4</label>
            <label for="5" data-value="5">5</label>
            <label for="6" data-value="6+">6</label>
 </div>

I tried using  
<%= f.select  :guests, [["1","1"], ["2","2"], ["3","3"], ["4","4"],
["5","5"],["6","6"]], id: "guests", class: "form-control" %>

But not working

A:

There is a helper method called options_for_select which transforms an array of arrays into select input options.
<%= f.select :guests, options_for_select([["1","1"],["2","2"],["3","3"],["4","4"],
["5","5"],["6","6"]]), id: "guests", class: "form-control" %>

documentation : http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-options_for_select

