Help with looping through groups of radio buttons

So my goal is to loop through and list several groups of shipping
options for various products. First I loop through the number of items
which need to be shipped alone, then I loop through the shipping
rates. What I want is each group to be able to have 1 selection and
pass along the params for use in the controller.

I need the ability to iterate or count the ss_ship_info so that each
name/value will be different params. I have tried both
‘ss_ship_info[@counter]’ and ‘ss_ship_info’[@counter] (this one has
really unexpected results, if I have 3 items. The first two act like a
single group but the third seems to be an individual group.)

Does anyone know a solution for my problem or at the very least could
point me in the direction of a guide relating to the subject?

##CODE##################

<% @sscount.times do %> #First Loop

<% for rate in @ups_ss_rates[@counter] %> # Second Loop

<%= radio_button_tag(‘ss_ship_info[]’[@counter], rate[0]) %>
<%= rate[0] %> - <%=
sub_number_to_currency((rate[1])) %>


<% end %>

<% @counter += 1 %>

<% end %>

The formtastic gem might be able to help you.

It makes writing forms a lot easier and has helpers for writing groups
of buttons and stuff. Here’s an example from the readme on github…
f.input :authors, :as => :check_boxes, :collection => User.find(:all,
:order => “last_name ASC”)
f.input :authors, :as => :check_boxes, :collection =>
current_user.company.users.active
f.input :authors, :as => :check_boxes, :collection => [@justin, @kate]
f.input :authors, :as => :check_boxes, :collection => [“Justin”,
“Kate”, “Amelia”, “Gus”, “Meg”]
f.input :author, :as => :select, :collection =>
Author.find(:all)
f.input :author, :as => :select, :collection => { @justin.name
=> @justin.id, @kate.name => @kate.id }
f.input :author, :as => :select, :collection => [“Justin”,
“Kate”, “Amelia”, “Gus”, “Meg”]
f.input :author, :as => :radio, :collection => User.find(:all)
f.input :author, :as => :radio, :collection => [@justin, @kate]
f.input :author, :as => :radio, :collection => { @justin.name
=> @justin.id, @kate.name => @kate.id }
f.input :author, :as => :radio, :collection => [“Justin”,
“Kate”, “Amelia”, “Gus”, “Meg”]
f.input :admin, :as => :radio, :collection => [“Yes!”, “No”]