Syed Humza Shah


Engineering leader. Likes coffee. Loves to travel. Runs on a combination of optimism and pragmatism.

Read more about him here.

Use ActiveRecord to Easily Aggregate Row in Groups

Recently, I offered a solution to group records via ActiveRecord according to the date ranges they were created in.

That got me thinking about other scenarios in which we need to group records. Usually such grouping is followed up by some aggregation method such as count or sum.

When you sit down to get it done, the job becomes quite tedious. Hopefully, this will no longer be the case, thanks to the gem I just finished writing.

For simple “group –> aggregate” scenarios, I think it’ll be of great use.

Check it out: ConvenientGrouper