Short Ruby Newsletter - edition 112

The one where Jeremy launched the Liminal forum and with many releases - Ruby 3.2.6, Rails 8.0.0.rc2, Hanami 2.0.0.rc1, Rails 7.1.6, Rails 7.2.2 and the big discussion about Fibers

In partnership with

Table of Contents

Unlock Windsurf Editor, by Codeium.

Introducing the Windsurf Editor, the first agentic IDE. All the features you know and love from Codeium’s extensions plus new capabilities such as Cascade that act as collaborative AI agents, combining the best of copilot and agent systems. This flow state of working with AI creates a step-change in AI capability that results in truly magical moments.

Download It Free Today

🚀 Launches and discounts

🚀 Jeremy Smith launched Liminal is here - Just forums – no livestreaming, no events, no courses, no chat, Optimized for long-form, async discussion

🚀 Trae Robrock launched Email.rb - Dead simple email. Transactional email shouldn't cost a fortune

Source: @trobrock

🚀 Keygen launched Engines - API Reference - Documentation

Source: @keygen_sh

📚 Pragmatic Programmers shared Agile Web Development with Rails 8

Source: @pragprog

📅 Events

📅 Ruby Conf shared about having a track curated by Akira Matsuda - organiser of RubyKaigi:

Source: @rubyconf

Source: @rubyconf

Tim Riley from Hanamirb also announced a Hanami Hack Day at RubyConf. Details here

📅 Thoughtbot announced Intro to AI for Rails developers with Chad Pytel

Source: @thoughtbot

📅 Tropical.Rb launched the tickets last week, but they are now Sold Out

📅 Check RubyConferences.org for meetups or conferences happening this week and don’t forget to submit yours if you are organising one.

👉 All about Code and Ruby

👉 Nagachika shared Ruby 3.2.6 Released

Source: @nagachika

👉 Nick Quaranto announced that Rubygems reached billions of gem downloads:

Source: @qrush

👉 Rafael Franca announced Rails 8.0.0.rc2 

👉 Tim Riley announced Hanami 2.2.0.rc1

Source: hanamirb.com

💻 Code Samples

️💻 Drew Bragg wondered about using Ruby methods for adding values and how the send method changes results:

Source: @DRBragg

Ufuk Kayserilioglu explained what happens there:

Source: @paracycle

️💻 ️Nate Hopkins shared a code sample about how a Team of AI Agents might look like:

Source: @hopsoft

️💻 Josef Strzibny shared a tip about disabling STI in Rails with inheritance_column:

Source: @strzibnyj

️💻 Charles Oliver Nutter shared about JRuby performance:

Source: @headius

and added:

Source: @headius

️💻 Stephen Margheim shared a code sample for testing controllers with public methods that do not have a corresponding route defined:

💻 ️Daveyon Mayne shared about re-implementing how Basecamp approaches updating a record:

Source: @sylarruby

# Source: https://x.com/sylarruby/status/1851168812705489000
module Orphanage
  extend ActiveSupport::Concern

  included do
    has_many :orphans, class_name: "RecordingOrphan"
  end

  def adopt(new_object)
    transaction do
      orphans.create! recordable: recordable, updated_by: User.first

      # Change pointer
      update! recordable: new_object
    end
  end
end

# 

def update
  recording = @parent.children.find(params[:recording_id])
  if (@meal = new_meal).valid?
    recording.adopt @meal
  end
end

️💻 Ruby Cademy shared a code sample about runnig ffmpeg to transform audio files:

Source: @RubyCademy

💻 Drew Bragg shared a code sample with an interesting behavior:

Source: @drbragg.dev

️💻 Wilbert Liu shared about protecting routes in Rails 8:

Source: @wilbertliu

Source: @wilbertliu

️💻 Kyrylo Silin shared about coloring Rails logger:

Source: @kyrylosilin

Here is code snippted from the gist but you should also read the comments in that gist:

# Source https://gist.github.com/kyrylo/3d90f7a656d1a0accf244b8f1d25999b

module ColorizedLogger
  COLOR_CODES = {
    debug:   "\e[36m",  # Cyan
    info:    "\e[32m",  # Green
    warn:    "\e[33m",  # Yellow
    error:   "\e[31m",  # Red
    fatal:   "\e[35m",  # Magenta
    unknown: "\e[37m"   # White (or terminal default)
  }.freeze

  RESET = "\e[0m"

  def debug(progname = nil, &block)
    super(colorize(:debug, progname, &block))
  end

  def info(progname = nil, &block)
    super(colorize(:info, progname, &block))
  end

  def warn(progname = nil, &block)
    super(colorize(:warn, progname, &block))
  end

  def error(progname = nil, &block)
    super(colorize(:error, progname, &block))
  end

  def fatal(progname = nil, &block)
    super(colorize(:fatal, progname, &block))
  end

  def unknown(progname = nil, &block)
    super(colorize(:unknown, progname, &block))
  end

  private

  def colorize(level, message, &block)
    "#{COLOR_CODES[level]}#{message || (block && block.call)}#{RESET}"
  end
end

Rails.logger.extend(ColorizedLogger)

️💻 Ruby Cademy shared a code samplea bout using Symbol to Proc shorthand:

Source: @RubyCademy

️💻 Lucian Ghinda shared about using the Ruby debug gem:

📐 Thinking about Code Design

📐 Aaron Patterson shared a thread about fibers, that started like this:

He shared a couple of gists stating:

  • “They don't prevent race conditions” → async-race.rb

  • “They don't respect GVL release” → test.rb

And added:

Jp Camara responded to each of them one by one, I am adding here the first reply, but you can read an organised response here:

Samuel Williams also replied with:

Adam Daniels showed how they are using async:

️️📐 Greg Molnar shared about ShiftFast drama:

Source: @GregMolnar

📐 Jason Swett shared why CanCan's load_and_authorize_resource isn't a good example of DRY:

Source: @JasonSwett

️📐 Nate Berkopec shared about the ratio of untestable Ruby lines per developer before the risk will go very high:

and also shared about queues naming and SLOs:

️📐 Samuel Williams shared a proof of concept for interactive Rails streaming:

️📐 Nate Berkopec shared about service layer:

💡Around code (news, findings, books, and more - all about Ruby)

💡 Ruby Association announced the 2024 Ruby Association Grant selection result. There were 3 projects selected:

“PicoRuby2: New PicoRuby Using mruby as VM” - Hitoshi Hasumi

“This project will integrate the mruby as a general-purpose embedded language with the PicoRuby ecosystem, which has expertise in microcontroller application development, aiming to bring ISO/IEC 30170-compliant Ruby to microcontroller programming and expand the scope of application development”

“Implementing a plugin system for RDoc” - Masafumi Okura

“This project aims to implement a plugin system in RDoc so that RDoc can meet diverse requirements and demands and become the central tool for Ruby documentation.”

“Creating a 2D retro game engine based on Processing Gem” - tokujiros

“Based on last year’s project, “Processing Gem for CRuby, working towards better compatibility with the original Processing” we will leverage the results, namely the Processing Gem, to develop a new 2D retro game engine.

This game engine targets retro games and intentionally limits specifications such as resolution, color palette, and audio features. By simplifying the development process in this way, we aim to create an environment where even beginners can easily start developing games.”

💡 If you are on Bluesky and posting about Ruby/Rails Joshua Wood is inviting you to fill in this form to be added to his Ruby/Rails Starter Pack:

💡️Victor Cobos shared about using a VScode extension to comment code in ERB:

Source: @elalemanyo

💡 Nick Schwaderer shared a list of historic_ruby_resources.md

Source: @schwad_rb

 💡 Tom Rossi announced they are starting a Product Founders community:

Source: @tomrossi7

💡 Jakob Skjerning shared they designed the first Ruby on Rails website:

You can see a way back machine version here.

❤️ Why Choose Ruby and Rails

❤️ Hans Schnedlitz shared about talking about Ruby on Rails to people from outside our community:

Source: @hschnedlitz

🧰 Gems, Libraries, Tools and Updates

🆕 New Gems and Repos

🆕 Yaroslav Shmarov announced a new boilerplate for Rails 8 Moneygun - Multitenancy Teams boilerplate

🆕 Stephen Diaconou announced a new gem awfy: CLI tool to help run suites of benchmarks , and compare results between control implementations, across branches and with or without YJIT

Here is a code sample:

# benchmarks/tests/struct.rb

# A group is a collection of related reports
Awfy.group "Struct" do
  # A report is a collection of tests related to one method or feature we want to benchmark
  report "#some_method" do
    # We do not want to the benchmark to include the creation of the object
    my_struct = MyStruct.new(name: "John", age: 30)
    ruby_struct = Struct.new(:name, :age).new("John", 30)
    dry_struct = DryStruct.new(name: "John", age: 30)
    active_model_attributes = ActiveModelAttributes.new(name: "John", age: 30)
    
    # "control" blocks are used to compare the performance to other implementations
    control "Ruby Struct" do
      ruby_struct.some_method
    end
    
    control "Dry::Struct" do
      dry_struct.some_method
    end
    
    control "ActiveModel::Attributes" do
      active_model_attributes.some_method
    end
    
    # This is our implementation under test
    test "MyStruct" do
      my_struct.some_method
    end  
  end
  
end

🆕 Javi Ramirez announced a new gem trackdown: 📍 Ruby gem to geolocate IPs (MaxMind BYOK)

🆕Brad Gessler announced a new gem uri-builder - Work with URLs a little easier in Ruby

🆕 Javi Ramirez announced a new gem footprinted: 👣 Ruby gem to track geolocated user activity in Rails

🆕 Javi Ramirez announced a new version of nondisposable: 🗑️ Block disposable emails in your Rails app

🆕 Kristoph announced a new gem intelligence - A Ruby gem for seamlessly and uniformly interacting with large language and vision model (LLM) API's served by numerous services, including those of OpenAI, Anthropic, Google and others

Source: @ikristoph

🆕 Typecraft published a new repo showing how to configure Neovim to work with Rails - this is a simple ruby on rails configuration for neovim

🆕 Joshua Wood published a new gem about festive_errors - Add some year-round holiday cheer to the Rails error page

🧰 Updates

🧰 Ruby On Rails announced a new version of Rails Versions 7.1.5 and 7.2.2 have been released!

Source: @rails

🧰 Samuel Williams announced a new feature coming in Ruby 3.4 Feature #20855: Introduce Fiber::Scheduler#blocking_region to avoid stalling the event loop

🧰 Postmodern announced a new vulnerability for Sinatra CVE-2024-21510

🧰 Mike Dalessio announced a new version of 2024-10-30 · sparklemotion/sqlite3-ruby

Source: @flavorjones

🧰 Bozhidar Batsov announced a new version of Release RuboCop 1.68 · rubocop/rubocop

🧰 Maciej Mensfeld noticed tha Jean Boussier is doing a series of improvements for ruby/json:

🧰 Joel Drapper announced that Literal 1.0 is out

🧰 Hans Schnedlitz announced a new version of puny-monitor - A batteries-included monitoring tool for single hosts. Works great with Kamal

Source: @hschnedlitz

🧰 Svyatoslav Kryukov announced a new version of turbo-mount - Use React, Vue, Svelte, and other components with Hotwire

🧰 Jeremy Evans announced a new version of Sequel 5.86.0 Released · jeremyevans/sequel · Discussion #2239

🧰 Jet Brains Ruby Mine announced a new version of RubyMine editor:

Source: @rubymine

🧰 Samuel Williams announced a merged PR for Rails Don’t buffer things that shouldn’t be buffered

🧰 Thomas Leitner announced the version 1.0.0 of HexaPDF

 

👀 Keep an eye on

👀 Jorge Manrubia shared a PR they opened for RubyGems about Add option to configure zeitwerk in new gems by jorgemanrubia · Pull Request #8198 · rubygems

🤝 Xavier Noria shared a quote from The Art of Readable Code:

Source: @fxn

🤝 Jason Swett shared a related advice about explaining root cause when fixing a bug:

Source: @JasonSwett

🤝 ️Kyrylo Silin shared their thoughts about TDD and the problems with TDD. I am adding here just the first part of the post (you should read it all here)

Source: @kyrylosilin (read it on threadreader)

Here are some replies:

Source: @GregMolnar

Source: @madejejej

🤝 Kyri shared about how to configure Nginx

Source: @kkyrio

they also shared:

Source: @kkyrio

🤝 Andras Bacsai shared Update a Hetzner Firewall rule with your IP address

Source: @heyandras

More content: 📚 🗞 🎧 🎥 ✍🏾

🗞 Newsletters

🗞 Greg Molnar published a new edition of This Week in Rails about Default Regexp.timeout and more!

🗞 Ruby Weekly published a new edition about All Ruby treats, no tricks

🗞 Hotwire Weekly published a new edition about Week 44 - Comparing Hotwire with HTMX, Nested Models in One Form, and more!

🗞 Awesome Ruby Newsletter published a new article about Issue 441 - Benchmarking Ruby Parsers

🎧 Podcasts

🎧 Adrian Marin published a new episode of Friendly.show about Celebrating Rails World 2024 with Tom Rossi from Buzzsprout. Rails conventions

🎧 Indie Rails published a new episode about Just a bunch of guys

🎧 Ode to RailsConf published a new episode about Elise Shaffer

🎧 Maintainable Software Podcast published a new episode about Obie Fernandez: Pioneering AI in Ruby on Rails Development

🎧 The Rails Changelog published a new episode about The Rails Changelog | 027: Migrating a Rails Monolith from MySQL to Trilogy with Adrianna Chang

🎧 Thoughtbot published a new episode about 445: Working Iteratively

🎧 Remote Ruby published a new episode about RubyGems & Ruby Central with Marty Haught

🎧 Ruby Rogues published a new episode about Embracing AI Efficiency in Rails Development - RUBY 658

📽️ 🎥 Videos

🎥 Kasper Timm Hansen published a new video about Oaken: Fresh take on Fixtures and Seeds - Julián Pinzón Eslava

🎥 TypeFast published a new video about Deploying Rails 7 apps with Kamal 2 with Postgres

🎥 Greg Molnar published a new video about Using Okta with Rails

🎥 Chris Oliver published a new video about How To Use Importmaps With Rails (Example) | GoRails

🎥 Dean De Hart published a new video about Rate Limiting in Ruby on Rails 7.2

🎥 Drifting Ruby published a new video about Turbo Frame Targets and about Kamal Kitchen Sink

🎥 Typecraft published a new video about This is possibly my favorite Neovim and Rails config

🎥 Jeremy Smith published a new video about Liminal - A place for calm, long-form discussions

🎥 Yaroslav Shmarov published a new episode about Exploring the SupeRails source code | SupeRails #207

🎥 DoCodeDo published a new episode about Create Nested Models with One Form // Ruby on Rails Nested Attributes Explained

🎥 Malachi Rails published a new episode about Intro to Ruby on Rails 7 Full stack Tutorial | Rails for Beginners Part 3 and about Intro to Ruby on Rails 7 Full stack Tutorial | Rails for Beginners Part 4

🎥 Arkency published a new episode about 10 Arkency lessons from Rails apps for 2025

🎥 Jason Swett published a new episode about Upgrading SaturnCI to Rails 8.0 and about Mentorship Session with Abhay Joshi (Plus a SaturnCI Update) and about The Terrible Job Market

✍🏾 Articles

What’s new 🆕

Benoit Daloze published a new article about Benchmarking Ruby Parsers · On the Edge of Ruby

RubyCademy published a new article about Did you know that you can control access to inheritance in Ruby?

Jean Boussier published a new article about Next Generation Out of Band Garbage Collection

Radan Skoric published an article about Hotwire and HTMX - Same Principles, Different Approaches

Prasanth Chaduvula published an article about Rails 7.1 Adds after_discard Method To ActiveJob For Discarded Jobs

RoR vs Wild published a new article about Speed Up Compound Full-Text Searches in PostgreSQL by 300x

Bill Tihen published a new article about Rails with Postgres - Fuzzy Searches

Ayush Newatia published an article about The Basics of Rack for Ruby

Lucas M. published an article about Ruby exception Handling Pitfall: Understanding Rescue Clause Hierarchy

Exequiel Rozas published a new article about Serving static assets with a CDN in Rails

Jess Brown published a new article about Let PostgreSQL Generate Your CSV in Rails

David Stosik published a new article about Deploying Writebook with Kamal 2

Fritz Meissner published an article about LLMs can read text: Overlooked AI-assisted coding techniques

Délon Newman published an article about ruby -run

Daniel Doubrovkine published a new article about Safely Passing Ruby Variables to JavaScript in ERB

How-TOs 📝

Julian Rubisch published a new article about Refresh when Visible

Rails Designer published an article about Hotwire and Stimulus Tools You Need to Know

William Kennedy published a new article about Up and Running with Hotwire Native iOS 2

Jason Meller published a new article about 1Password and Rails' Kamal: Kindred Spirits

Takashi SAKAGUCHI published an article about Smart way to update multiple models simultaneously in Rails

Igor Alexandrov published a new article about Use Docker to template local database

Jeffery Morhous published an article about A practical GitHub Actions pipeline example with Rails

Jamie Lawrence published an article about Why Podia doesn’t use review apps anymore

BestWeb Ventures published an article about Russian Doll Caching in Rails: A Complete Guide to Fragment Caching Optimization,  ViewComponent vs Phlex vs Partials: A Comprehensive Comparison in Ruby on Rails and about Understanding Ruby 3.3 Concurrency: A Comprehensive Guide

Bohdan Pohorilets published an article about [EN] How I upgraded my pet project from Rails 7 to Rails 8 in 30 minutes

RubyCademy published a new article about SQL JOINS: Defeat the monster!

Bozhidar Batsov published a new article about 40 - (think)

All issues