Tutorials

Collecting Prometheus metrics from multi-process web servers, the Ruby case | Michal Kazmierczak
In Prometheus, metrics collection must follow concrete rules. For example, counters must be either always monotonically increasing or reset to zero. Violating this rule will result in collecting nonsensical data.It is a challenge with multi-proces...

Appropriately using Ruby’s Thread.handle_interrupt
Working on GoodJob, I spend a lot of time thinking about multithreaded behavior in Ruby. One piece of Ruby functionality that I don’t see written about very often is Thread.handle_interrupt. Big thanks to John Bachir and Matthew Draper for talking...


Throttling Rails logins with Rack Attack | Greg Molnar
This week, I will show you how to rate-limit your authentication endpoints with Rack::Attack.Rack::Attack is a middleware for blocking or throttling requests based on rules. It uses the configured cache store of Rails to store the necessary data, ...


Let's Implement the Map Method from First Principles
After writing the above post, I got a few emails asking me to explain how anonymous functions are different from regular functions and when to use them.In short, you know they are an important concept, and all the examples make sense, but you've n...



TIL: Turbo Stream and personalised content — Good Enough
Hotwire and Turbo are great for very quickly and easily adding real-time updating of webpages without requiring the browser to reload the whole page.But if the information you want to stream back from your server to the client has anything specifi...

Rails 7.1 enhances PostgreSQL enum functionality | Shakacode
In Ruby on Rails, PostgreSQL provides an extension for defining enumerations, which allows you to specify a set of possible values for a column. This is useful when limiting your model's allowed values for a particular attribute.Apart from creatin...