Skip to content

Instantly share code, notes, and snippets.

@rafamvc
Last active August 29, 2015 14:02
Show Gist options
  • Save rafamvc/e698958fba52abf0dd70 to your computer and use it in GitHub Desktop.
Save rafamvc/e698958fba52abf0dd70 to your computer and use it in GitHub Desktop.
<% categories_column_size = (categories.size / 4).ceil %>
<div class="row">
<% # the false on the next line removes the nils you used to protect with the if category %>
<% categories.in_groups_of(categories_column_size, false) do |n_categories| %>
<div class="large-3 columns">
<% n_categories.each do |category| %>
<div class="row">
<div class="large-10 columns">
<%= label_tag category.name, category.name, class: 'right inline' %>
</div>
<div class="large-2 columns">
<%= check_box_tag "categories[#{category.id}]", "1", false, class: 'left inline' %>
</div>
</div>
<% end %>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment