#​651 — April 27, 2023

Read on the Web

Together with  AppSignal logo

Ruby Weekly

MRSK: Hot Deployment Tool to Watch—or Total Game Changer? — The Evil Martians team gives DHH’s new container-based MRSK deployment tool a ‘vibe check’. The conclusion is that it has potential but there are various things to weigh up before you switch boats.

Evil Martians

🚢 In related news, the official MRSK homepage at MRSK.dev has lost its original brutalist design and now looks slick and ready to sail. There's a 20-minute screencast introduction from DHH to enjoy as well.

Some Advanced Active Record Concepts — Quick examples of concepts including locking records to avoid conflicts, using UUIDs as primary keys, fulltext search, using database views, and working with geospatial data.

Paweł Dąbrowski

Smooth and Powerful Sidekiq Monitoring — Track and debug Sidekiq performance metrics with ease. Get insights and alerts for Sidekiq queue lengths, Sidekiq throughput/performance per worker, and Sidekiq process/connection counts.

AppSignal sponsor

How Ruby's 'Switch' is More Flexible Than You Thought — It might be switch in C, but in Ruby it’s case and offers a lot more than just being syntactic sugar for if/else constructs. Akshay shows off some of its extra features.

Akshay Khot

Stop Ignoring Your Ruby and Rails Deprecations (and How) — No-one wants to see warnings and it’s tempting to skip over them, but they’re there for a reason. Ali explains how deprecation warnings can help you upgrade your app before you really upgrade your app (which can help a lot when upgrading Rails versions in particular), and shows off of a technique for formally making deprecations part of an app’s reality.

Ali Ibrahim


📕 Tutorials, Articles, and Videos

Updating Millions of Records in Rails — Ideally you’d step down to the database layer and avoid the overhead of Active Record entirely when doing large numbers of updates, but if that’s not viable, this is a reasonable Ruby-based approach based around Sidekiq and updating records in batches.

Tomas Valent

Making Lazy Accessors Thread-Safe — Greg created a gem called Feature Envy that pulls in features from other languages. In this case, he creates thread-safe, lazy attributes in Ruby, which is more involved than you might expect.

Greg Navis

How to Use OmniAuth to Add Authentication to Your Ruby App — Check out this strategy that leverages the OmniAuth gem and OIDC to add log in to your application with FusionAuth.

FusionAuth sponsor

Build a Memory Game with Rails, Stimulus JS, and Tailwind CSS — This is a good old step-by-step tutorial, with much of the focus on Stimulus and how it can be used to incrementally add functionality to Rails apps.

Marvin Kang

The Hardest Question on a Ruby Array Quiz — Only 2.07% of participants in a recent quiz got this one right – mostly because of not knowing the default no-argument behavior of split, I suspect. This is all really just trivia, but I did learn that Array#sum does not only act upon numeric objects..

Domhnall Murphy

Solving N+1 Postgres Queries for Rails Apps — Tips for working with ActiveRecord and using better SQL to improve performance and avoid N+1 queries.

Christopher Winslett

Rails 7, Bootstrap CSS, and JavaScript with esbuild — How to introduce Bootstrap into an existing Rails 7 with esbuild handling the bundling.

Ryan Bigg

▶  Writing 'Boring' Code with the Help of ChatGPT — Avdi is well known as a Ruby developer who runs the Graceful.dev screencast site, so it makes sense he might turn to ChatGPT when using a less.. engaging language like PHP. 😆

Avdi Grimm

Why Duplication is More Acceptable in Tests — DRY isn't the only way.

Jason Swett

Containerize a Rails 7 App and Run it on Vultr with Cloud 66
Kasia Hoffman (Cloud 66)

Seven Common Mistakes in Rails Upgrades
Rishi Jain (FastRuby)

🛠 Code & Tools

ViewComponent 3.0: React-like View Components for Rails — A framework for building reusable, testable & encapsulated view components in Rails, inspired by React. v3.0, a pretty significant release featuring work from over 200 contributors, was unveiled at RailsConf earlier this week.

ViewComponent Contributors

Low Cost, Rails Code Audit by a Senior Dev — We rapidly review your app using a nine point audit including security, tech debt, performance, versions and code quality with full recommendations on each.

reinteractive Pty Ltd sponsor

FastCount: Quickly Get a Count Estimation for Large Tables — Requires Active Record 6+. Mostly benefits Postgres users (via this approach), but will transparently work with MySQL, MariaDB, and SQLite too.


Maxitest 4.4: Minitest, Plus All The Features You Always WantedToo many features to list here, to be fair.

Michael Grosser

If you want to test a feature that not only requires SSL/TLS but also a custom domain of your choice, and all on a locally running app, there are a variety of ways to achieve this. An approach I really like is using mkcert and Caddy.

On macOS, it's as simple as this:

brew install mkcert
brew install nss # if you use Firefox
brew install caddy

(Note: If you're using Linux, use these instructions instead.)

Then you can install mkcert and generate the certificate of your choice like so:

mkcert --install
mkcert app.acme.com

mkcert creates certificates against a local-only certificate authority that your browser will recognize, allowing you to create and sign against any domains of your choice. A Caddyfile will then act as the HTTP server terminating the TLS connection and serving up the certificate:

reverse_proxy localhost:3000
tls app.acme.com.pem app.acme.com-key.pem

Then you need to add a line like app.acme.com to your /etc/hosts file, run your app in the usual way, and then run caddy run for everything to spring into action. (Note: If your app server runs on a different port to 3000, you can update that in the Caddyfile above.)

Note: This is just a quick recap for Ruby Weekly but you can find the complete blog post at Running Rails Development with a Fake Domain and SSL on the Cloud 66 blog.


Find Ruby Jobs with Hired — Hired makes job hunting easy-instead of chasing recruiters, companies approach you with salary details up front. Create a free profile now.