RubyFlow The Ruby and Rails community linklog

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

Today

Upgrading a Rails app from Ruby 3.4.4 to 4.0.3: what actually breaks

Ruby 4.0 is the first major bump in over a decade, but a Rails 8.x app usually upgrades in a day of focused work. Most of the pain is not in the language: it is gems that left the default set (cgi, ostruct, logger, benchmark), the Ractor::Port rewrite, Kernel#open("| cmd") no longer spawning a process, and a handful of changes that break tests rather than code (Set#inspect output, Net::HTTP no longer defaulting Content-Type on bodies, new backtrace frames that confuse Sentry/Datadog grouping rules). Read more

Gravity Defied, the old fashion motorbike game, rebuilt with pure Ruby physics

Remember Gravity Defied, the motorbike game from old Nokia phones? I rebuilt it on DragonRuby GTK with the physics written in pure Ruby: no physics engine, just six point masses joined by springs and 16.16 fixed-point math. Thanks to WebAssembly, you can play it right in the browser with all 30 original tracks. Since every run is deterministic, a small beam-search bot finds clean runs offline, and the game replays them frame for frame

SolidJobs + SolidTrace + Warm IPC perform worker 2000 alloc/s vs 200 alloc/s sidekiq

We are told that to scale Ruby background workloads across multiple CPU cores, we have two choices: process forking (e.g., Pitchfork) which incurs massive Copy-on-Write memory overhead and risk of OOM kills under load, or database-backed queues (e.g., Solid Queue) which introduce heavy synchronous disk I/O and row-locking bottlenecks [1.8, 1.10]. To break this cycle, I built SolidJobs (v0.5.0): an open-source, Ractor-local Redis task runtime engineered from scratch around a strict shared-nothing architecture [1.8]. Read more

Rails engines: a gem that lives inside your app

How to build a feature as a Rails engine in a folder of the main app, loaded as a path gem. Covers isolate_namespace, appending the engine’s migrations to the host instead of copying them, a single lambda hook for auth so the engine never depends on the host, and where engines hurt (specs, Zeitwerk, schema visibility). Real code from a short-link and click-tracking feature. Read more

A practical guide to AI in Rails with RubyLLM: structured text, tools, images

I wrote up the code behind the AI-generated cover images on my blog: a text model summarizes a post, an image model draws the summary, and Active Storage keeps the result. AI with Ruby and Rails: A Practical Guide with RubyLLM goes through it in nine steps with RubyLLM 2.1 and Gemini: a service object for the first call, structured output with with_schema, tool calling, RubyLLM.paint, and moving generation to a background job before Kamal’s proxy times out. It also covers rescuing provider errors and catching the content-filtered reply that comes back empty without raising. The last steps treat user content as data rather than instructions and test without touching the network.

Kill SSH on ECS: get a Rails console via ECS Exec with Terraform

Still keeping port 22 open and a key pair in your launch template just so someone can run rails console in staging? This guide walks through replacing SSH with AWS SSM Session Manager and ECS Exec using Terraform. It covers IAM for instance and task roles, VPC endpoints for private subnets, exec logging, rolling it out through CI, and the gotchas that eat the most time: tasks that predate enable_execute_command, log groups created by hand, and TargetNotConnectedException. It ends with a troubleshooting table and a checklist for production.

I've made a experimental 3d engine that uses mruby

I’ve been building a small 3D game engine using mruby: https://github.com/carlosdanielpohlod/redgem The engine is written in C++, but I wanted Ruby to be the main way to build games with it. It has physics, a 3D editor, Blender level import, and a few other things. It’s still a work in progress, and I used AI quite a lot to help build it. There’s definitely room for improvement, but I thought it would be interesting to share it with the mruby community. Read more

introducing runsheets, an executable runbook

runsheets is a Ruby gem that serves markdown runbooks as a local web page. Fenced code blocks you mark as runnable get a Run button. Every run is written to a “runsheet” (aka session log) that records each command exactly as it ran, its output, its exit status and timing, and each time the operator signs off on a manual step. Secret inputs are redacted from the output, and a destructive block won’t run until the operator types a confirmation code. runsheets --check lints a runbook, --new builds one from templates, and --run runs a single step from the terminal. It’s a proof of concept, and I’d like feedback from people who use runbooks every day. Install it with gem install runsheets (it needs Ruby 3.4 or newer), and see the docs for more.

Deploying a Rails 8 App to a VPS with Kamal 2: A Practical Guide

A start-to-finish walkthrough of shipping a Rails 8 app to a single VPS with Kamal 2, using Vite, Solid Queue, PostgreSQL as a Kamal accessory and Docker Hub. It focuses on the errors you will probably hit: a Dockerfile with no Node.js, a database.yml that falls back to localhost, SOLID_QUEUE_IN_PUMA=false turning the Puma plugin on, uncommitted changes that Kamal never builds, and Let’s Encrypt failing on DNS. It ends with what Kamal leaves to you: backups, HA and Postgres major upgrades. Read more

Loading older posts