Find the radio buttons selected in a page

I have a survey taking page with a set of questions. Each question has
five radio buttons. After answering the questions user clicks submit.
Then based on the selection the values must be updated in the table
called results.

Each row in the results table represents a unique radio button.

the code is here
All the radio buttons each having unique result id are being passes in
results.ids[]
But I want only the selected ones.
I am new to ruby on rails…can you please help me out?

<% if @questions.size>0 %>

<% form_tag :action => ‘results_update’, :method => :put do %>

<% for @q in @questions %>
<%= “Q.#{@q.text}”%>


<% @results = Results.where(:Questions_id => @q.id) %>
<% for r in @results %>
<%= radio_button_tag @q.id, ‘results.ids[]’,r.id%>
<%=h r.id%>


<% end %>


<%end%>

<%= submit_tag "Submit" %>

<% end %> <% else%>

<%= “There are no Questions in this survey”%>
<%end%>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs