title: How to group collection by columns
body: <p>I am trying to group my product properties by the property set that they below to, i.e. I have Size as a property set and wish to group under it Small, Medium, Large etc..</p>
  
  <p>This is the code I currently have but I am getting a few errors</p>
  
  <pre><code>- Property.all.group_by(&amp;:property_set_id).each do |property_set, properties|
    h3= property_set.name
  - properties.each do |property|
    = property.property_set.name
    .property_form.left.span-9.last
      - checked = property_set.name &amp;&amp; property_set.properties.include?(property)
      label.mdl-switch.mdl-js-switch.mdl-js-ripple-effect for=property.name
        = check_box_tag "prototype[property_ids][]", property.id, checked, :class =&gt; 'mdl-switch__input', :id =&gt; property.name
        span.mdl-switch__label= property.name
  
  
    def edit
      @properties = Property.all
      @property_set = PropertySet.includes(:properties).find(params[:id])
    end
  </code></pre>