Boring Rails

Articles

Event sourcing for smooth brains: building a basic event-driven system in Rails

Event sourcing is a jargon filled mess, but we can build a lean version with just ActiveRecord, callbacks, and a bit of boring code. Learn how to create simple, yet powerful event-driven systems in Rails.

Writing better Action Mailers: Revisiting a core Rails concept

Mailers are used in literally every Rails application, but often an after thought where we throw out the rules of software design. Revisiting the tools provided by Action Mailer can help us improve how we write mailers.

Thinking in Hotwire: Progressive Enhancement

Your mental model for Hotwire should be progressive enhancement: start with the basics and layer on Turbo Frames, Streams, and Stimulus as you build more.

Galaxy brain CSS tricks with Hotwire and Rails

Techniques for working with CSS in Hotwire and Rails that will make you say "wait..you did that with only CSS?!"

Adding keyboard shortcuts and hotkeys to StimulusJS

A review of the ecosystem for adding hotkeys to your Stimulus controllers: stimulus-hotkeys, stimulus-use/useHotkeys, HotKey.js, and github/hotkey

The most underrated Rails helper: dom_id

One of the oldest helpers in Rails is also the most underrated. `dom_id` shines for building apps with Hotwire, allowing you to easily target parts of the page without a bunch of nasty string interpolation.

Self-destructing StimulusJS controllers

Add sprinkles of Javascript behavior with Stimulus controllers that run a few lines of code and then remove themselves from the page. Like inlined jQuery snippets but for the modern times!

Tailwind style CSS transitions with StimulusJS

Build polished UI components with StimulusJS and Enter/leave CSS Transitions using patterns from Vue, Alpine, and Tailwind.

Building a Rails CI pipeline with GitHub Actions

GitHub Actions is an automation platform that you run directly from inside a repository. We can use it as a testing CI/CD pipeline and keep everything close to the code.

Magic Responsive Tables with Stimulus and IntersectionObserver

Responsive HTML data tables are a tricky problem that usually requires scrolling on small screens. With a sprinkle of Stimulus and the IntersectionObserver API, we can build a small enhancement to make the user experience more pleasant.

Hacktoberfest Recap: Open source Ruby/Rails work in 2020

A recap of my Rails-related contributions for the 2020 Hacktoberfest event: ViewComponent, Bullet, LRUG, and Circulate

Building GitHub-style Hovercards with StimulusJS and HTML-over-the-wire

Turbolinks, Stimulus, and Server Rendered HTML is a compelling alternative to modern JavaScript single page apps. Let's build a hovercard to see how you can kick it old school with a more boring approach.

Writing better StimulusJS controllers

Stimulus sprinkles interactive behavior on top of your boring HTML pages. By keeping your controllers small, generic, and composable you can build a front-end without the typical JavaScript mess.

Feature Flags: The stupid simple way to de-stress production releases

Feature flags bridge the gap between the abstract concept of continuous delivery and tactical release of features. Start small with a glorified if-statement before adding more complicated tooling to get the most bang for your buck.

Spring Cleaning: Tidying up your codebase

A practical checklist for tidying up your gems, pruning old git branches, removing unused views and routes, and cleaning up your database. A little bit goes a long way when it comes to cleaning!

Wrangling slow reports, large file exports, and long-running tasks in Rails with Active Job

Sometimes we need to generate really large file exports or run reports that are just slow. It's not enough to optimize a few queries, we need to move the work to a background job and notify the user when it's all done.

Managing Rails schema and data migrations without losing your mind

Rails database migrations are extremely powerful, but can be a mess if we don't avoid the traps. This article outlines a boring way to handle schema and data migrations effectively.