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… »

Roll Your Own XML Templater in Ruby

In this post, we'll use Jim Weirich's XML Builder gem [https://github.com/jimweirich/builder] and the magic of Tilt [https://github.com/rtomayko/tilt] to build our very own XML template engine. What is a Template Engine? A template engine is any code or software… »

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… »

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 [https://www.thegreatcodeadventure.com/tracking-user-state-with-phoenix-presence-react-and-redux/], 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… »