The Ruby Dispatch

Ruby and Rails applications are awesome on Fly.io! This is the home for Ruby-oriented content including Rails, Sinatra, Turbo, Rack, and more.

By Sam Ruby

Fly.io ❤️ Kamal

I’ve been scouting out what it will take to update Agile Web Development with Rails 7 for Rails 8, and chapter 17 (Deployment and Production) will need be rewritten to focus on Kamal. This naturally lead me to spend a few hours deploying my Showcase

Read more
By Julian Rubisch

Execute Third Party Code in a Rails App

Imagine inviting random strangers from the internet to bring along their code and run it on your servers in a Rails app. Sounds like a security nightmare, doesn’t it? Where do you even start? If you run into a person at Fly.io, they might be saying s

Read more
By Brad Gessler

The Plan for Rails 8

Rails published an 8.0 milestone on Github that lays out the goals for the next Rails release, and it’s sprawling. It ships with a new background worker, cache backend, asset pipeline, framework for pushing notifications to mobile devices, and a load

Read more
By Brad Gessler

Rails on Docker without Docker

Docker will play a major role in the future of Rails production deployments, but not everybody wants to learn Docker, understand Linux systems administration, and install additional tooling on their workstations. Fortunately Fly.io can do this heavy l

Read more
By Brad Gessler

8 Turbo 8 "Gotchas"

As the final release of Turbo 8 nears, there are a few “gotchas” worth knowing about that will make life easier as you start updating existing Rails Turbo apps to take advantage of all the new features that Turbo 8 offers, like page morphs 1. Don’t sc

Read more
By Brad Gessler

Turbo 8 in 8 minutes

Turbo 8 simplifies the development of live-updating Rails applications. It offers a dramatic leap forward from previous versions by minimizing the need for manually coding turbo frames and turbo stream responses. This advancement simplifies both the c

Read more
By Brad Gessler

SQLite Persistence Canary

As the world boldly moves towards running SQLite in production, there’s a bit of a problem that looms in today’s container-based production environments: persistence. Ever since cloud servers arrived on scene, we’ve been told over and over again to n

Read more
By Sam Ruby

Audience of One

I’ve got an app for scheduling dance competitions. I unretired to explore hosting it on the cloud. I’ve written about how it is configured. In the first year this application was used to schedule events in six cities. As we are coming to a close o

Read more
By Sam Ruby

Accommodating Safari Users

When you generate a new Rails app, you are given a choice whether or not you want JavaScript support or to include a CSS framework. The default is to use import maps. What isn’t clear at this time is that there is no documented upgrade path should

Read more
By Brad Gessler

Better Rails Forms with Superform

Rails form helpers have been around for so long that they seem unquestionable, but did you know there’s a way to build forms in Rails that are easier to customize and permit their own strong parameters? Superform is a new form helper library built fr

Read more
By Brad Gessler

SQLite & Rails in Production

When deploying a Rails application to production, its rare to question the idea of running a Postgres or MySQL database to persist data and Redis for caching, background job processing, and WebSockets, but what if it could all be done without running

Read more
By Brad Gessler

Organic Test Driven Development

Test-driven development sounds like a really “heavy”, dogmatic way of building applications, but it can be surprisingly organic and lightweight starting with “does it run?” as the first test, followed by more formal unit test verification. When I set

Read more
By Sam Ruby

Push to Subscribe

All your favorite social apps have the ability to send you notifications even when you aren’t even using them. Sending notifications used to require different mechanisms for different clients, but with Safari joining the party, now is a good time to

Read more
By Brad Gessler

Pattern Matching on Ruby Objects

Ruby pattern matching landed in 2.7 via the case … in… statement. It’s a very powerful control structure the can make Ruby code cleaner and easier to read. In this article we’ll explore the basics of how pattern matching can make your Ruby code more

Read more
By Sam Ruby

Around the World With SQLite3 and Rsync

Take a typical Rails application, run fly launch, then fly deploy, say yes a few times and you will have a Dockerfile provided for you, with two instances of your application up and running, a PostgreSQL database, and an Upstash Redis database. This

Read more
By Nathan Willson

RubyKaigi 2023: Matsumoto

The RubyKaigi conference was in Matsumoto this year, surrounded by beautiful mountains in Nagano Prefecture. It’s an annual conference in Japan that brings Rubyists from around the world to celebrate Ruby and the community. I ate a lot of local soba.

Read more
By Brad Gessler

Welcome to Rails Cheat Sheet

Rails has been around since early 2004. Back then, the choices of building web applications was either working with a bunch of spaghetti code that was SFTP'ed up to a server or work with an enterprise monstrosity like Enterprise Java Beans. Rails show

Read more
By Brad Gessler

Hacking Rails Implicit Rendering for View Components & Fun

Understanding how Rails handles requests from routes.rb to calling the action method on a controller makes it possible to build Rails plugins ranging from Hanami-like action classes to component-driven Rails development. Have you ever opened a Rails

Read more
By Brad Gessler

Component driven development on Rails with Phlex

Building applications entirely from UI components can be a great way to manage complexity in non-trivial application views, especially when using CSS frameworks like TailwindCSS. It’s a technique that’s been used with great success, by many communitie

Read more
By Brad Gessler

Humane Rails Forms

How many times have you cursed at a date form field because it rejected 03/01/22 and wanted 03/01/2023? Number inputs are the same—what if instead of copy & pasting from the calculator app you could enter 79 / 2 in a field and have it evaluate to 39.5

Read more
By Sam Ruby

Introducing Live Elements

Ruby on Rails contains everything you need: Rendering HTML templates, updating databases, sending and receiving emails, maintaining live pages via WebSockets, enqueuing jobs for asynchronous work, storing uploads in the cloud, providing solid securi

Read more
By Brad Gessler

Pairing with GPT-4

GPT-4 can be helpful for beginner and senior Ruby developers, but it does have limitations. It won’t write all of your software for you, but it will point you in a useful direction, especially if you prefer learning by doing. Let’s look at how well G

Read more
By Sam Ruby

MRSK vs Fly.io

MRSK was introduced last month and it truly is a game changer. From the announcement: It sits on top of basic Docker, and harvests all the benefits you get from isolated containers with a sliver of the complexity associated with most other solution

Read more
By Brad Gessler

Little Gestures of Confidence Make Our Tools & Community Better

The world is a much better place when we say “please” and “thanks” as we go about our daily lives. The same should be true for the tools, frameworks, documentation, and code we use in Ruby—and a little effort can go a really long way to build confiden

Read more
By Sam Ruby

CI/CD

You’ve been a model developer. You’ve placed your source code under version control and posted it to GitHub. You’ve got a suite of tests, and they run green. You’ve deployed your software to production. That’s a lot of work. You deserve a break.

Read more
By Sam Ruby

Health Checks

Rails 7.1 is adding discoverable health checks, which fly launch will automatically configure and monitor. This page will tell you what you need to know. No matter how well you plan, you will always need to be prepared to deal with unforeseen and un

Read more
By Brad Gessler

Rails on Docker

Rails 7.1 is getting an official Dockerfile, which should make it easier to deploy Rails applications to production environments that support Docker. Think of it as a pre-configured Linux box that will work for most Rails applications. That means you

Read more
By Brad Gessler

Monkey Patch Responsibly

What are the hazards of Monkey Patching in Ruby? How you can create a Monkey Patch that you can share responsibly and safely with the Ruby community without causing bugs from forgetting to remove the patch. We live in an imperfect world, which means

Read more
By Brad Gessler

Single File Rails Apps

There’s been a few interesting blog posts written about single file Rails applications, but they all seem to stop short of describing practical use cases where you might actually ship a single page Rails application. Problem: I need a lightweight CMS

Read more
By Sam Ruby

Dockerfile-less-deploys

Introduction First, let’s talk about why we decided to use OCI container images in the first place. In short, containers are freaking awesome. They allow us to package up our applications and all of their dependencies into a single, self-contained uni

Read more
By Brad Gessler

Rails Background Jobs with Fly Machines

Fly Machines can boot a VM in 500ms, run a Rails background job, then turn off when it’s done. That means you don’t have to pay for a server to sit idle if there’s no jobs to process and you can have a much more scalable pool of on-demand workers when

Read more
By Sam Ruby

Using TurboStream with the Fetch API

Many people see Rails as a framework that will get you to IPO and beyond. I, personally, I’m more interested in the long tail of applications that are used by only a small group of people. I wrote one such application to schedule heats for ballroom

Read more
By Brad Gessler

Making Sense of Rails Assets

The Rails asset ecosystem is at peak complexity as it transitions from Sprockets to Importmaps and Propshaft, by way of Webpacker. How does it affect people who build Rails apps? How should Rails plugin developers navigate the transition? Rails has a

Read more
By Brad Gessler

Semi-Static Websites

Static websites have exploded in popularity over the past few years. What is it that people like so much about static site generators? Low operational complexity - Static websites can be deployed to a production environment without the need for a d

Read more
By Joshua Sierles

Run Ordinary Rails Apps Globally

If you’ve used your own Rails application from another continent, you may get the feeling that physics has beaten your performance tuning efforts. Page loads feel a bit sluggish, even with all the right database indexes and fancy CDN-backed assets.

Read more