Posted By

smoothdzion on 11/23/09


Tagged

rails ruby ror views


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

smoothdzion


RoR - Snippet for Join Table Checkboxes


 / Published in: Rails
 

Used to create checkboxes to select multiple categories for a post or any other type of applicable situation.

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

Report this snippet  

You need to login to post a comment.