Xavier Lange
2006-Mar-10 17:22 UTC
[Rails] Multiple radio buttons for defining multiple objects?
Hi, I''ve been working on a multiple choice Question/Answer system. The
response object (analagous to a lineitem) has a question_id, user_id,
and the actual response. What''s a good way of making a form with
multiple response objects which are created from the radio_button
helper?
Right now I''ve got the following code:
##################################################
<%= start_form_tag :action => ''dump'', :id => @user.id
%>
<p><label for="quesion_1">Question
1</label><br/>
True <%= radio_button(''responses'',
''response'', ''true'')%>
False <%= radio_button(''responses'',
''response'', ''false'')%>
Maybe <%= radio_button(''responses'',
''response'', ''maybe'')%></p>
##################################################
I''m just using dump to show the params, which puts out
{"responses"=>{"response"=>"true"},
"commit"=>"Take the test",
"action"=>"dump", "id"=>"8",
"controller"=>"survey"}. How do I add a
question_id, user_id straight into that "responses" hash?
Also, how should I create multiple response objects later? I''m very
shakey on how to create multiple instances of the same object from one
form...
Thanks,
Xavier
--
Posted via http://www.ruby-forum.com/.
