Ewout Van Troostenberghe

Ewout Van Troostenberghe

Dancing with Arel: filterkit and reportkit

Watch the video

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? class Invoice column :total_price, :money, arel(:line_items)[:total_price].sum end