lundi 28 septembre 2015

how to get checkbox for subcategories in ruby

i want to display checkbox buttons to subcategory in ruby with its parent and child in ruby

like this

    `category
       checkbox subcategory
       checkbox subcategory
    category
       checkbox subcategory
       checkbox subcategory
    category
       checkbox subcategory
       checkbox subcategory`



    This is my code .
    ` <% Category.all.each do |c| %>
            <%= check_box_tag "category_ids[]", c.id, :id => "category_ids_#{c.id}" %>
            <%= c.name%>
            <% end %>`




please modify this . here i am getting every category and sub category with checked option. i want checkbox only to subcategories.

Aucun commentaire:

Enregistrer un commentaire