Radio buttons

I am new to ruby on rails.i need to create a page with a question and multiple choice answers with radio button to answer .i ve stored the database in a table with one column ha the question and the other four with answers. i ve to populate the fifth column with the answer selected with the radio button. is this way approprite for me to go and please to guide how to create the radio buttons and how to populate the fifth column with the selected answer.

I suggest you work through some rails tutorials to show you the basics of rails. railstutorial.org is good and is free to use online. There are others. Make sure that the tutorial is for the version of rails that you have installed, which should be 3.1. Also look at the Railscasts and Rails Guides.

Colin

I do not think the structure you described will accomplish what you want. Capturing the selected answer in the same table row as the question will mean the survey can only have one participant, as subsequent answer selections would overwrite the previous answer. You will likely want to create a survey table, user table, and a user_survey table that captures each participant's selections. The surveys will have many user through the user_survey relationship and the same for users if they can participate in multiple surveys.

CavalryJim wrote in post #1033545:

I am new to ruby on rails.i need to create a page with a question and multiple choice answers with radio button to answer .i ve stored the database in a table with one column ha the question and the other four with answers. i ve to populate the fifth column with the answer selected with the radio button. is this way approprite for me to go and please to guide how to create the radio buttons and how to populate the fifth column with the selected answer.

-- Posted viahttp://www.ruby-forum.com/.

I do not think the structure you described will accomplish what you want. Capturing the selected answer in the same table row as the question will mean the survey can only have one participant, as subsequent answer selections would overwrite the previous answer. You will likely want to create a survey table, user table, and a user_survey table that captures each participant's selections. The surveys will have many user through the user_survey relationship and the same for users if they can participate in multiple surveys.

hi calvin thank you for ur reply i ve changed my design such that the selected answer does not get saved in the database.i decided to compare the input from the radio button to the correct answer and store the scores in the session level varaible. but i m not able to read the radio buttons input with the params[:query] in the same view where the radio button is designed.where shold this params[:query] be used. if it has to be used in the controller how can it be called. if there a special kind of form_tag for the radio buttons getting the input ion a session level [variable]