A Custom Design Pattern for Building Dynamic ActiveRecord Queries

July 14, 2023 36 min Free

Description

This talk introduces a custom design pattern for building dynamic ActiveRecord queries, focusing on the pain points of composing performant, dynamic, and readable database queries in enterprise Rails applications. The presenter explores various tools for query composition, including raw SQL, ActiveRecord, and Arrow tables, before detailing a proprietary query builder and visitor pattern developed at G2. This pattern leverages domain-specific language principles and object-oriented design to create modular, maintainable, and powerful query objects without external libraries.