Ruby on Rails - Help creating a poll with multiple choice questions

Hi there,

i watched you tutorial to build a Polling application with Rails and i would like to add some features like the possibility to create a question with multiple answers but instead of have radio buttons it will have checkboxes and the users could choose more than one option.

for now i added a new partial to the replies views with the following code:

  <%= c.label :value, c.object.question.title %>                                                          
<div class="checkbox">                                                                                    
  <% c.object.question.possible_answers.each do |possible_answer| %>                                      
          <%= check_box_tag( 'possible_answer_id['+']', %>   
          <%= possible_answer.title %>                                                                    
          <%= c.hidden_field :question_id %>                                                              
  <% end %>                                                                                               

i can reply for the poll but the answers from the checkbox questions won’t be saved in the answers table.
Probably i have to change the associations between the models but i can’t make it work.
Can anyone help me please?

Thank you all!