RoR - Snippet for Join Table Checkboxes


/ Published in: Rails
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.