Sign up for my newsletter

Let's learn to become better developers.

Understanding ActiveStorage Variants for Image Transformations in Rails

Image transformations let you show images in the size or format you need. You can create a new version by calling variant on an attachment and passing the desired transformations. When a browser requests that URL, Rails will process the original image on demand and redirect to the generated file.

January 16, 2026

Understanding ActiveStorage Variants for Image Transformations in Rails

You Can Now Access Bearer Tokens Directly from Request

The new bearer_token method on the Request object is a nice addition to Rails. It removes boilerplate code and simplifies bearer token extraction. All Rails apps can now access bearer tokens the same way without having to write custom token extraction logic every time and worrying about edge cases.

December 30, 2025

You Can Now Access Bearer Tokens Directly from Request

Combined Credentials in Rails 8.2

Rails 8.2 adds support for combined credentials, a unified API that checks environment variables first, then falls back to encrypted credentials, with consistent behavior for nested keys, defaults, and error handling. It's also possible to use your own combined configuration.

December 22, 2025

Combined Credentials in Rails 8.2

Active Storage Internals: How has_one_attached DSL Works

In this post, we'll explore the internals of has_one_attached method in Active Storage. It covers two interesting patterns, i.e. proxy and change objects. We'll trace the control flow from the model DSL to persistence and uploads, and explain how files are created, detached, and purged.

October 18, 2025

Has One Attached Active Storage

Active Storage Domain Model: Blobs and Attachments

Active Storage uses two main models: blobs and attachments. Blobs store the uploaded file's metadata and a link to the actual file, while attachments link those files to records. Understanding how they work together makes it easier to manage uploads, generate URLs, and process uploaded files.

October 16, 2025

Active Storage Architecture

Rails on Localhost: Secure Context and Local HTTPS with Caddy

Localhost is treated as a trustworthy origin even without TLS, so all apps on localhost run in a secure context. This allows secure features to work in development. You can also run multiple apps on localhost with subdomains + ports to separate them. When you do need local HTTPS, use Caddy server.

September 08, 2025

DHH Rails World Keynote - Localhost

Sitemaps: A Quick SEO Win for New Websites

A sitemap lists your site's pages, helping Google crawl it efficiently. It's especially useful for large sites or new sites with zero backlinks. This post shows how you can create one in your Rails site, how to add it to Google Search Console, and how to index new pages as soon as you publish them.

July 11, 2025

Sitemaps are a Quick SEO Win for New Websites

Polymorphic URLs with direct Router Helper

The Rails router's direct method lets you create custom url and path helpers, which is especially useful for polymorphic models and delegated types. This post shows how to use a single custom helper to generate URLs for different models, with a practical example from the open source Maybe project.

July 08, 2025

Polymorphic URLs with direct Router Helper

Working Effectively with AI as a Developer

I started as a sceptic, but now I'm a convert and a heavy user of AI for everyday programming, and wanted to write down some common patterns and prompts for working with AI tools that I’ve found useful in my own development workflow as well as those I learned from other experienced developers.

June 19, 2025

Working Effectively with AI as a Developer

How to Inspect the Sequence of Controller Callbacks in Rails

This post shows how to inspect the sequence of before, after, and around callbacks in Rails controllers by adding a small initializer. Useful for understanding callback order in applications with complex controller hierarchies or shared concerns. I learned this trick while reading the Rails tests.

June 17, 2025

How to Inspect the Sequence of Controller Callbacks in Rails