Posted By

bordalix on 07/13/07


Tagged

checkboxes habtm


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

endorfin
webstic
anderson812


HABTM checkboxes


 / Published in: Rails
 

The right and fastest way to have a HABTM checkboxes, railscast #17

  1. <% for category in Category.find(:all) %>
  2. <div>
  3. <%= check_box_tag "product[category_ids][]", category.id
  4. @product.categories.include?(category) %>
  5. </div>
  6. <% end %>

Report this snippet  

You need to login to post a comment.