Using a dynamic number of checkboxes in a rails form
        Posted  
        
            by TenJack
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by TenJack
        
        
        
        Published on 2010-03-26T06:07:31Z
        Indexed on 
            2010/03/26
            6:13 UTC
        
        
        Read the original article
        Hit count: 476
        
I am trying to create a form with a dynamic number of checkboxes that each link to a string that is not a model number but is instead just a word. For examples:
<% form_for(@words) do |f| %>
    <% ["apple","banana","orange"].each do |word| %>
        <%= f.check_box :word %>
        <%= f.submit %>
    <% end %>
<% end %>
So, if "apple" was checked, it would just send the string "apple" in the params. Anyone know how to do this?
© Stack Overflow or respective owner