Rails Dashboards that scale – with SQL and dry-struct - Philippe Creux
14-Jul-2025 152
Rails Dashboards that scale: crunch data with SQL, return JSON, wrap it in type-safe DryStructs, and swap in Faker or plug into a data warehouseWhy Not ActiveRecord?
ActiveRecord is a great ORM for typical CRUD operations. While it offers a handful of methods to aggregate data such as .group, .sum, and .joins, they are not sufficient for complex reporting queries.
That’s where raw SQL with Common Table Expressions (CTEs) shines. If you’re not familiar with CTEs (Common Table Expressions), they’re like temporary views that let you transform data from one shape into another. Here we transform operational data into a format suitable for reporting.
Rails Dashboards that scale – with SQL and dry-struct - Philippe Creux #ruby #rubydeveloper #rubyonrails #Rails #Dashboards #scale #dry-struct #Philippe #Creux #sql https://rubyonrails.ba/link/rails-dashboards-that-scale-with-sql-and-dry-struct-philippe-creux