I have a Product related to sizes by way of has_and_belongs_to_many. Currently in my product form partial, I have this really ugly (although functional) code. Note the hanging ">" that closes the "<input>".
<p><label for="sizes">Sizes</label><br/> <% for size in @sizes %> <input type="checkbox" id="<%= size.id %>" name="size_ids" value="<%= size.id %>" <%if @product.sizes.include? size %>checked<%end%> > <%= size.name %> <% end %>
Is there a method that will let me do this and have nicer looking code? I've had a hard time finding it if there is.