While we can piece together Reports and Dashboards using ActiveRecord, it can be more efficient to use SQL to transform data and dry-struct to turn query results into Ruby objects with strong typing. Why 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…
At Zipline , we offer a one-stop shop application for retail employees that handles everything from clocking to task management and team communication. To achieve this, we need to integrate with numerous third-party applications with unique requirements. We decided to develop a satellite service called ZipIO for data synchronization. In this post, I’ll review our journey of building this robust…
Once a Rails app has 50+ models and controllers, it’s time to organize the code by feature using Rails engines. We give each feature a directory containing the app code, tests, migrations, and routes specific to it. It looks like a mini-rails app that only contains the code related to that feature. Working with these mini-rails apps is a breeze! You can fully expand the app/* directories, and they…
I had to handle webhooks on most web applications that I worked on: email events (deliveries, bounces, etc), payment/subscription notifications, inbound emails, etc. They can all contain large payloads and multiple events, and they expect the app to return promptly a successful response otherwise they eventually retry. I recommend to: Make the controller as simple as possible and process webhooks…
I really enjoy building data warehouses using dbt . dbt is a simple framework to define data transformation using plain SQL. We use it to transform data from our operational databases into tables for our datawarehouse. Our dbt project can target both Postgres and BigQuery. This enables us to build the datawarehouse locally on Postgres. While we can quickly verify that the SQL syntax is valid,…