lonelycoder
lonelycoder

Reputation: 27

rails 4 radio buttons display extra label I don't want to display

I have multiple radio buttons which are working great (from an array) here is my code:

<%= [1, 2, 3].each do |item| %>
  <%= f.radio_button :date,  item %> <%=item %>
<% end %>

And here is the html code generated

<div class="form-group col-md-4">
  <label for="appointment_Dimanche">Dimanche</label>
  <br>
  <input id="appointment_date_1" name="appointment[date]" type="radio" value="1"> 1
  <input id="appointment_date_2" name="appointment[date]" type="radio" value="2"> 2
  <input id="appointment_date_3" name="appointment[date]" type="radio" value="3"> 3
      [1, 2, 3]      
</div>

And here is what I see

enter image description here

I want to know why it display the array from which I generate the radio buttons. And I don't want to display it any more.

Upvotes: 0

Views: 52

Answers (1)

Narasimha Reddy - Geeker
Narasimha Reddy - Geeker

Reputation: 3880

Try this

`<% [1, 2, 3].each do |item| %>
 <%= f.radio_button :date,  item %> <%=item %>
 <% end %>` <br>

remove = in <%= [1,2,3].each ...]%>

Upvotes: 1

Related Questions