I am creating a survey with the following data model:MathTest has_many math_questions
On MathTest#update I want to create one form for every question. The form should look something like this:
<%= form_for(mathtest) do %>
<% math_question.each do |question| %>
<%= f.label :answer %>
<%= f.text_field :answer %>
<%= f.hidden_field math_question.id %>
<% end %>
<% f.submit %>
<% end %>
I want to send the MathTest Controller a set of tuples with a math_question id and the answer for that question. Then in the Controller, I can call another method that evaluates each question's answer.
How do I write my form to send the appropriate tuple?