I am trying to display 4 questions that I have in my database and display the possible answers for each question. Each question should have a different input type for its answers though. So if question one has radio buttons, I want question 2 to have checkboxes, and 3 to have text and so on. Any help would be greatly appreciated.
<h1>Please complete the short survey below:</h1>
<%= @submission.campaign.name %>
<form>
<ul>
<ol>
<% for question in @submission.campaign.questions %>
<li><%= question.question_verbiage %></li>
<ul>
<ol type = 'A'>
<% for possible_answer in question.possible_answers %>
<input type = 'radio' name = "possible_answer" value= "<%= possible_answer.id%>">
<li><%= possible_answer.answer_verbiage %></li>
<% end %>
</ol>
</ul>
これは、私が何をしたいのかを説明するのに役立ちます。これは、以下の質問が質問 2 であるが、代わりに質問 1 である場合に最適です。
<li><%= question.question_verbiage %></li>
<ul>
<ol type = 'A'>
<% for possible_answer in question.possible_answers %>
<input type = 'scale' name = "possible_answer" value= "<%= possible_answer.id%>">
<li><%= possible_answer.answer_verbiage %></li>
<% end %>
</ol>
</ul>