Ewout is a passionate ruby (and rails) developer with a computer science background an the accompanying obsession for beautiful code. Currently he is working at 10-forward where he spends most of his time developing th!nx, a non-trivial project management application.
Dancing with Arel: filterkit and reportkit
Get me all invoices since 2007 for clients that are in the photography business where I was responsible for, and group them by fiscal year and client with running totals." In business applications like th!nx, extensible filtering and reporting is paramount. While rails offers good abstractions for basic CRUD, it lacks facilities for complex aggregation. Filterkit and reportkit are two open-source libraries that work together to fill this gap, harnessing the power of arel. The goal? Not having a single line of SQL in your application while being able to create many reports like the one described above on demand. The API?
column :total_price, :money, arel(:line_items)[:total_price].sum