Field notes — essays & research notes

Things I've written down.

Ruby, Rails, performance, security and applied machine learning. Updated when something feels finished.

55 posts · page 5 of 6
RUBY & RAILS 04 / 08 / 26

Migrations that don't take the site down

The dangerous migrations aren't the slow ones. They're the ones that take a lock while old and new code are both running.

3 min
RUBY & RAILS 04 / 01 / 26

One statement instead of ten thousand

Saving records in a loop is the slowest correct way to write data. The alternatives are faster and quietly skip things you may be relying on.

2 min
RUBY & RAILS 03 / 25 / 26

Counting on read is a bug you ship on purpose

A count in a loop is the N+1 nobody spots, because each query is fast and the logs look fine.

2 min
SECURITY 03 / 18 / 26

Accepting files from strangers

An upload endpoint accepts arbitrary bytes chosen by someone you don't know. Almost every mistake here comes from trusting what they say it is.

2 min
RUBY & RAILS 03 / 11 / 26

Interactive without a single-page app

Turbo gets you most of what a client-side framework does, with the state still on the server where it is easier to reason about.

2 min
RUBY & RAILS 02 / 25 / 26

Feature flags you can build in an afternoon

The value is decoupling deploy from release. That does not require a platform, and the platform is not the hard part.

2 min
RUBY & RAILS 02 / 18 / 26

Ruby pattern matching, in code you'd actually ship

It is not a switch statement. It destructures and validates shape in one expression, which is exactly what parsing external data needs.

2 min
LLM & AGENTS 02 / 09 / 26

Your RAG chatbot doesn't have a model problem

It has a measurement problem. Why swapping the model is the last thing to try, what to instrument first, and how an aggregate score hides the failure that matters.

4 min
RUBY & RAILS 02 / 04 / 26

The garbage you never had to create

Ruby's collector is fast. The cheapest object is still the one you didn't allocate, and in hot paths that difference is measurable.

2 min