# Grouping in tables

**URL:** <https://www.ruby-forum.com/t/grouping-in-tables/167881>\
**Category:** Rails\
**Created:** [May 13, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/grouping-in-tables/167881 "2009-05-13T16:18:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [May 13, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/grouping-in-tables/167881/1 "2009-05-13T16:18:03Z")

</div>

I have an app which uses ActiveResource to get data from a non-Rails  
client. One of the things it has to do is display that data in a  
webpage, with subtotals by week. What’s an easy way to break up a  
collection of ARes instances by a column so I can then pump each group  
into a partial. The partial then displays the lines for that group, and  
a sub-total at the end.

The other way I could do it is to xml-ise the ARes records, generate the  
table, with groups and subtotals using XSLT, and then feed that as text  
into a render method. But that involves stepping outside Rails to format  
stuff.

Anyone have any ideas?

Thanks

John S.
