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 = Question.new
@code = “:q_code” + String(count)
if( params[:survey][@code] )
@question.question_code = code
@question.user_id = @user.id
@question.value = params[:survey][@temp]
@count += 1
@question.save!
else
count = false
end
end


As you can tell, I am trying to pass a variable name to params. Is
there a way to do this? Thanks!

Try these:
http://railscasts.com/episodes/17
http://railscasts.com/episodes/52

Andrew