This is a part of the show view of the exercise model:
<div id="smoke_screen" style="min-height:100px">
<% question = @exercise.random_question %>
<b class="question"><%= question.name %></b>
<ul>
<% question.answers.each do |answer| %>
<li><%= answer.content %></li>
<% end %>
</ul>
</div>
And it looks like this in the browser:
@answer and @question are nested models of exercise (exercise has_many questions, question has_many answers) and this is all viewed from the show view of the exercise model.
I'm trying to add a radio button to each answer and make an ajax call to an action i'll create named "save_answer". This action will receive both the question and answer objects, save the answer and return another question that will replace the #smoke_screen using ajax.
I'm new to rails, tried plenty of things with form_to
with the attribute :remote => true
without success. I will appreciate any direction on how to approach this