The RailsNotes Newsletter 🟥 ISSUE #10

🟥 ISSUE #10 (Celebrating 10 issues, Overmind, Stimulus, Database indexes)

Me celebrating 10 issues of the RailsNotes newsletter! 🥳

Welcome to The RailsNotes Newsletter — Issue #10!

This week we’re celebrating the 10th issue of the newsletter! 🥳🥳🥳

I started this newsletter 2.5 months ago (it feels like a lot longer 😅) to connect with the Ruby on Rails dev community, and share some of the interesting Rails articles I write + find around the web. I didn’t expect it to go so well!

I sent the first edition of the newsletter out to 30 of you — now, we’re just shy of 500 Rails devs and continuing to grow. It’s been awesome and I’m excited to keep writing!

This newsletter issue is a “best of” / highlights edition 🏆

I’ve collected the most popular articles from my previous issues and brought them together for you. There’s some great stuff here — Overmind, Stimulus, bin/dev and database indexes. I’m sure you’ll learn something, and if you’re feeling keen, you can browse the newsletter archive to read all the previous newsletters.

Let’s dive in!

FEATURED ARTICLE —

If Overmind is the pupetteer, your processes are the puppets. A question though — do our processes want to be puppeted? (dev/philosphy newsletter mashup incoming 😅)

This is, by far, the article you all enjoyed* the most. Thousands of Rails devs have read it, and rightly so! Overmind is an incredible tool and a massive level-up from foreman and the bin/dev script.

Like foreman, Overmind is a process runner — you give it a Procfile.dev with processes like web: and worker: inside, and it runs them for you in your local development environment.

Where Overmind shines is its depth, and its tmux integration. Overmind has heaps of settings for you to configure, so you can set what processes run, which ones can fail, etc. Its killer feature though is its tmux integration — Overmind uses tmux under the hood, and it runs all your processes in different tmux instances.

This lets you connect directly to your processes, while they’re running! It makes debugging 100x easier than with foreman, since you can just connect directly to a debugger instance in your main Rails server. There’s some other cool stuff too, which I’ll let you discover 😉 You can also check out the Overmind newsletter issue (#5).

* I can’t measure enjoyment, but this is the most popular article i’ve included in a newsletter and the most-viewed article on my blog.

🌐 MORE ARTICLES —

If Overmind is more than you need, this article will walk you through bin/dev and foreman, which both ship by default with Rails 7.

They’re a massive upgrade over rails s, and Nicks's article is a great intro to getting started with them. Like Overmind, bin/dev (and foreman under the hood) run processes from a Procfile.dev. You include processes like web: and worker:, and you can run them all with a single command.

If you’re interested to learn more about bin/dev after reading Nick’s article, I’ve written about it too —Procfile.dev, bin/dev, and Rails 7

I’ve included so many BoringRails articles in the newsletter, but this one remains my favourite. Matt Swanson dives deep into Stimulus controller design — specifically, how to stop writing hyper-specific controllers, and how to start writing reusable, generic ones.

This totally changed the way I write Stimulus controllers! If you use Stimulus yourself, I’d consider this article a must-read (and even if you don’t, you’ll learn something, I promise 🙏).

I’ve used the techniques from this article in some of my own Stimulus controllers — my tabs controller, and my toggle controller.

This article was a bit of a dark horse! I didn’t expect an article on database indexes to garner so much interest, but it seemed to strike a chord. Plus, it’s a great article!

This article dives into database indexes, in the context of Ruby on Rails apps. It’s a perfect place to start if you “kinda know a bit about indexes….” but don’t understand how to actually use them. It’s a higher-level article, but it links out to a couple more excellent ones which go deeper.

— ⚒️ HANDY TIP — 

→ Reference the previous result in the Rails Console

This is the first tip I ever published, and it’s still the one that has the most “usefulness” to me. It’s the one I find myself actually using day-to-day, and it’s just as handy as when I first learned about it!

You can use the _ (underscore) character in the rails console to reference the result of your previous command. It’s (probably!) not going to change your life, but it’s handy for grabbing a result that you forgot to assign to a variable.

If you use the Rails Console a lot for testing / playing around, this is going to come in very, very handy.

irb(main):001:0> User.first
=> <User id: 3, email: "[email protected]" >

# result stored inside _
irb(main):002:0> _        
=> <User id: 3, email: "[email protected]" >

# use previous result
irb(main):003:0> _.email    
=> "[email protected]"