How do I collect values from X number of radio buttons?

I am currently writing an application to collect data from a survey
form. I would like to write it so that it saves all of the information
from various radio buttons into the database. Obviously, I could hard-
code each individual radio button to be collected but I want to create
a loop that automatically does this in case new questions are added.
Here is some sample code I tried to use (but failed, obviously)

while( count )
    @question =
    @code = ":q_code" + String(count)
    if( params[:survey][@code] )
      @question.question_code = code
      @question.user_id =
    @question.value = params[:survey][@temp]
      @count += 1!
    count = false

Try these: