Formularz z radio button

Witajcie, może zaoszczędzicie mi trochę czasu, bo szukam i szukam i pewnie wymyśle wcześniej jakieś nieeleganckie rozwiązanie zanim znajdę.

Mam tablice @test_set_items i powiązane poprzez relację pytania i odpowiedzi. Chcę teraz w jednym formularzu submitować kilka instancji tego samego modelu/tej samej klasu. Pytanie jak?

[code]<% form_for :test_set, :url => { :action => :exam } do |form| %>

<% for tsi in @test_set_items %> <% end %>
Treść
<%= tsi.question.body %>
<% for answer in tsi.question.answers %> <%= cycle("A", "B", "C", "D") -%> <%= form.radio_button("answer", answer.id, "id" => tsi.id) %><%= answer.body %>
<% end %>
<%= submit_tag 'Wyslij' %> <% end %>[/code] "id" => tsi.id nie nadpisuje mi odpowiedniej wartości :( W agile.. mam przykład dla text form: [quote]If you need to edit multiple objects from the same model on one form, add open and closed brackets to the name of the instance variable you pass to the form helpers. This tells Rails to include the object’s id as part of the field name.[/quote] [code]<% form_tag do %> <% for @product in @products %> <%= text_field("product[]" , 'image_url') %>
<% end %> <%= submit_tag %> <% end %>[/code] i dla kontrolera [code]Product.update(params[:product].keys, params[:product].values)[/code] ale z radio button to nie idzie. macie jakiś pomysł, żeby ładnie update zrobić dla każdego test_set_item z odpowiednią wartością answer?

pozdrawiam

ok, już sobie poradziłem :slight_smile:
nie wiedziałem, że jest takie coś jak:
radio_button_tag

pozdrawiam