1

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:

enter image description here

@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

4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.