I have a Post model with a many-to-many Category association. In my Post form, I call f.input :categories, :as => :check_boxes
and get a nice ordered list of check boxes. Is there anyway to add a class to each <li>
using the category's name (or any Category data)?
Example:
<li class="<%= category.name %>">...label and input...</li>
<li class="<%= category.name %>">...label and input...</li>
<li class="<%= category.name %>">...label and input...</li>
Thanks!
Try something like
f.input :categories, :as => :check_boxes, :value_as_class => true