I am using RoR 2.3.5.
I would like to have list of questions with three possible answers.
After having copleted a test I would like to update the database with
user's answers. At the bottom of the page I would also like to list
all selected answers for the user.

In a table "answers" I have columns: question, a1, a2, a3 (these
columns are answers to the question),
a_u (user's answer), a_ok (correct answer). Below I have pasted the
view that I am using for listing questions.
But I have no idea how to list ALL answers at the bottom of the page
(now I know how to show only one answer). And how (in the most
effective way) to update the column "a_u" wtith ALL user's answers?
Could you help me?


#-----------------------------------------------------index.htm.erb
begin------------------------------------------------------------------
<h1>Listing answers</h1>

        <% @answers.each do |answer| %>
                <form >         <!-- action = "\answers\selected"        to 
gowno nie chce
dzialac -->
            <td><%=h answer.question %></td>
                <input type="radio" name="answer1"  value= <%=answer.a1%> /> 
<%=h
answer.a1 %>
                <input type="radio" name="answer1"  value= <%=answer.a2%> /> 
<%=h
answer.a2 %>
                <input type="radio" name="answer1"  value= <%=answer.a3%> /> 
<%=h
answer.a3 %>
                <input type="submit"/>
                </form>

        <% end %>
           <br/>

You selected <%= @data11 %>
#-----------------------------------------------------index.htm.erb
end------------------------------------------------------------------

In answers_controller I have included:

    @data11 = params[:answer1]


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to