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.

πŸš€ Launches and discounts

Source: @trobrock

Source: @keygen_sh

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

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

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

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

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

🧰 Updates

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

Source: @hschnedlitz

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

Source: @rubymine

🧰 Thomas Leitner announced the version 1.0.0 of HexaPDF

 

πŸ‘€ Keep an eye on

🀝 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

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

🎧 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

🎧 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

πŸŽ₯ 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

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

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

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

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

Reply

or to participate.