Composable Query Builders in Rails with Arel

We'll use Arel to build a flexible query builder class that will allow us to dynamically search our database given any search form input. This post focuses less on building intricate Arel queries and more on enacting a design pattern that allows us to leverage Arel in a composeable and… »

Roll Your Own XML Templater in Ruby

In this post, we'll use Jim Weirich's XML Builder gem and the magic of Tilt to build our very own XML template engine. What is a Template Engine? A template engine is any code or software responsible for creating documents out of a given data model and template. You're probably… »

DIY Google reCAPTCHA with Ruby

reCAPTCHA is an anti-bot tool you can implement in your web app to prevent bad actors from programmatically filling out forms and spamming your endpoints. In this post, we'll implement Google's reCAPTCHA protocol using the Google reCAPTCHA 2 client-side library and our very own hand-rolled verification client. I am Not… »

Building a Custom Logger with Active Support Tagged Logging

The ActiveSupport::Logger class is the go-to logging tool for Rails––the default Rails logger represents an instance of this class. Active Support provides some additional flexible logging classes that we can use to customize logging functionality in our Rails app. The default logger allows us to set logging levels,… »

Using Agent to Maintain Channel State in Phoenix

In my previous post, we used Phoenix Presence to track user presence in a given "challenge room" (think: chat room). In this post, we'll build our own Agent-backed module to track channel state that does not pertain to user presence. In our pair programming app, the shared text-editor is accompanied… »