Short Ruby News - Edition #91

Ruby 3.4 preview launched, Rails 8 development has started and a deep discussion about namespaces in Ruby. Plus a lot more inside.

You can jump directly to a section:

πŸš€ Launches & πŸ“… Events

πŸ‘‰ All about Code and Ruby: πŸ’» Code, πŸ“Code Design,πŸ’‘Around, ❀️ Why Choose Ruby

🧰 Gems, Libraries, and Updates: πŸ†• New, 🧰 Updates and πŸ‘€ Keep an eye on 

🀝 Related (but not Ruby-specific)

πŸš€ Launches

πŸš€ Stores Tech launched a game for RubyKaigi participants that you can play too in the browser Ruby "enbugging" quiz

πŸ“… Events

πŸ“… Nairuby has extended their Call for Proposals to 31st of May.

πŸš€ BalticRuby shared they are looking for sponsors:

πŸ‘‰ All about Code and Ruby

πŸ‘‰  Yui Naruse announced a new version of Ruby 3.4.0 preview1 Released

πŸ‘‰ Xavier Noria shared about performance improvement in Ruby 3.4 by rewriting Array.each in Ruby:

Here is the current implementation of Ruby master that was initially proposed in Feature 20182 and updated in this PR:

Takashi Kokubun shared in the PR also some benchmarks for this implementation:

πŸ‘‰ Jose Farias shared a podcast where Jason Fried announced a new ONCE product that will be free, but we don’t know yet what product will be β†’ A Matter of Ambition: Part 2 – REWORK podcast

πŸ‘‰ David Heinemeier Hansson announced that the branch is created for Rails 7.2 and Add Kamal by default to Rails 8

You should also check this commit by Rafael Franca called β€œDevelopment of Rails 8.0 starts now” and if you want to see the progress follow the Rails 8 Milestone

πŸ’» Code Samples

πŸ‘‰ Yusuke Endoh shared a gist t.md 

πŸ‘‰ Ruby On Rails shared a tip about allowing templates to set explicit locals:

Here is a good guide about strict locals in Rails partials written by Joe Masilotti and the official Rails documentation.

πŸ‘‰ Soutaro Matsumoto shares how you can define a method with keyword arguments using keyword names.

πŸ‘‰ Simon George has an open challenge for you. If you know a way, do let him know.

He also added:

πŸ‘‰ Hiroya Fujinami shared how they implemented a new syntax for Ruby using Prism:

πŸ‘‰ Josef Strzibny shared about referencing a specific foreign_key table in Rails migrations:

πŸ‘‰ Chris Oliver shared a tip about using min, max and clamp instead of conditionals:

πŸ‘‰ Mika Henriksson shares his solution on the issue where ActiveStorage allows you to load all assets from your production bucket in other environments, but not preventing you from actually deleting those files.

πŸ‘‰ Chris Oliver shares on how to convert Strings to Symbols to make dynamic symbols in Ruby.

πŸ‘‰ Xavier Noria shared about Ruby classes:

πŸ‘‰ Michael Koper shares a tip he learned from DHH’s Campfire code

πŸ‘‰ Bhumi shared a rails tip for rails routes.

πŸ‘‰Bozhidar Batsov asked on Mastodon and Twitter:

Here are some of the replies:

πŸ‘‰ Lucian Ghinda shared a thred about configuring code snippets in RubyMine and VScode for debug gem:

πŸ“ Thinking about Code Design

πŸ“ Richard Schneeman published on Reddit a post about how Ruby GC works:

He shared a list of resources to read I will put here the entire recommendation because it is very very good with his own words about each resource:

Why does my App's Memory Use Grow Over Time? - Start here, a good high level overview of what causes a system's memory to grow that will help you develop an understanding of how Ruby allocates and uses memory at the application level.

Complete Guide to Rails Performance (Book) - This book is by Nate Berkopec and is excellent. I recommend it to someone at least once a week.

How Ruby uses memory - This is a lower level look at precisely what "retained" and "allocated" memory means. It uses small scripts to demonstrate Ruby memory behavior. It also explains why the "total max" memory of our system rarely goes down.

How Ruby uses memory (Video) - If you're new to the concepts of object allocation this might be an excellent place to start (you can skip the first story in the video, the rest are about memory). Memory stuff starts at 13 minutes

Jumping off the Ruby Memory Cliff - Sometimes you might see a 'cliff' in your memory metrics or a saw-tooth pattern. This article explores why that behavior exists and what it means.

Ruby Memory Use (Heroku Devcenter article I maintain) - This article focuses on alleviating the symptoms of high memory use.

Debugging a memory leak on Heroku - TLDR; It's probably not a leak. Still worth reading to see how you can come to the same conclusions yourself. Content is valid for other environments than Heroku. Lots of examples of using the tool `derailed_benchmarks` (that I wrote).

The Life-Changing Magic of Tidying Active Record Allocations (Blog + Video) - This post shows how I used tools to track down and eliminate memory allocations in real life. All of the examples are from patches I submitted to Rails, but the process works the same for finding allocations caused by your application logic.

N+1 Queries or Memory Problems: Why not Solve Both? - Goes through a tricky real world scenario from 2017 where an N+1 query was killing performance, but using "eager loading" used too much memory. I had to re-work the flow of the code to extract the data that was needed while avoiding extra memory allocations.

πŸ‘‰ Chris Salzberg shared a thread about the presentation from RubyKaigi about Namespace, What and Why

Some replies to this thread are interesting to read. Here are some replies/reactions about this, but before making your mind up, you should read the discussion on the Ruby issue tracker (it is long and discusses various aspects and edge cases).

You can play with the namespace in the Ruby Playground

πŸ“ Matt Swanson shared rails stats from their app:

πŸ“ Jason Charnes is contemplating a significant change in their approach to building web applications with Rails.

πŸ“ Nate Berkopec shares insight about the impact of parallel versus serial requests on user experience in web applications.

πŸ“ Kevin Vanzandberghe shared performance gains by enabling YJIT

πŸ“ Andrei Bondarev shared about how they helped a company switch from micro-services to Rails monolith:

Read the entire thread as it goes into detail about how this happened.

πŸ“ Mohammad A. Ali shared about how Litestack brings the efficiency of SQLite to Ruby applications:

πŸ‘‰ Nate Berkopec shared about how many requests per server does a Rails app server per vCPU:

Nate added later a bigger explanation about why that number seems low. Read the entire post, here is just a piece of it:

πŸ’‘ Around code (news, findings, books, and more - all about Ruby)

πŸ’‘ Emmanuel Hayford shares how strings will be considered frozen by default from Ruby 3.4

πŸ’‘ Prem Sichanugrist quotes on how Ruby has become more contributor friendly

πŸ’‘ Mohammad A. Ali shares about his comparison of two solutions for using SQLite as Rails cache store

Solution A:

Solution B:

πŸ’‘ Josh Pigford wishes for Rails to have a quick auth generator

Josh Brown shared authentication-zero gem which could serve the same purpose.

What’s even better is that this might be coming along with Rails 8!

πŸ’‘ Keshav Biswa finds out that NASA uses Rails!

πŸ’‘ John Pollard asked about the decision making process for Rails:

Here is an answer from Eileen M. Uchitelle about the decisions taken in the Rails Core:

πŸ’‘ Maxime Chevalier shared about performance as a feature:

πŸ‘‰ Lucian Ghinda asked about a Ruby gem that will allow to select a snapshot of production DB:

Here are the recommended gems or scripts or but there were multiple ideas about how to do this in the Twitter replies or Mastodon replies:

❀️ Why Choose Ruby

❀️ Josef Strzibny says why there is nothing like too much Ruby.

❀️ John Pollard says how RoR developer experience is often overlooked upon.

❀️ Felipe Vogel shared their experience from RailsConf 2024 - The Ruby community is for everyone

❀️ Vzb is having fun building again on full-stack RubyOnRails

❀️ Lucian Ghinda asked why people love Ruby programming language:

There are a lot of answers on both Twitter and Mastodon that I cannot pick one to add here and adding all of them will make this huge newsletter almost infinite.

🧰 Gems, Libraries, Tools and Updates

πŸ†• New Gems and Repos

πŸ†•  Brooke Kuhlmann published a new gem called irb-kit

 

🧰 Updates

🧰 Xavier Noria announced a new version of Zeitwerk:

🧰 Stimulus Reflex announced a new version of StimulusReflex v3.5.0

🧰 Kasper Timm Hansen announced a new version of Release v0.6.0 Β· kaspth/oaken

🧰 Garrett Dimon shares his experience on using Kasper’s active_record-associated_object gem to organize model logic.

🧰 Mari Imaizumi announced a new version of reline:

πŸ‘€ Keep an eye on

πŸ‘€ Fabian shares about intuitive rails behavior.

🀝 Related (but not Ruby-specific)

🀝 Mika Henriksson tips on how to tweak your post-deploy while using Kamal post-deploy hooks with AppSignal.

🀝 Jason Swett shared about tests being product specifications:

🀝 David Heinemeier Hansson shared about automated testing:

🀝 Josh Brown shares a gist for Template Renderer

🀝 Cosmin shared about the inert HTML attribute:

🀝 Caleb Porzio shared that web browsers have a native dropdown (check caniuse before using it in your product)

🀝 Aditya Agarwal shared about weekly 1:1s:

More content: πŸ“š πŸ—ž 🎧 πŸŽ₯ ✍🏾

Soutaro Matsumoto shared their slides from RubyKaigi 2024 - Embedding it into Ruby code

Chris Oliver published their slides about Crafting Rails Plugins

Yuta Saito published their slides about RubyGems on ruby.wasm

Yusuke Endoh published their slides about Good first issues of TypeProf

Koichi Ito published their slides about RuboCop: LSP and Prism

Soutaro Matsumoto published their slides about Embedding it into Ruby code

πŸ—ž Newsletters

πŸ—ž Allison Pike published a new edition Once a Maintainer: Okura Masafumi

πŸ—ž Ruby Weekly published a new edition about A first glimpse of Ruby 3.4

πŸ—ž Awesome Ruby Newsletter issued a new edition Awesome Ruby Newsletter - Issue 417

πŸ—ž Hotwire Weekly published a new edition about Week 20 - New Turbo Native videos, mounting components in Hotwire apps, and more!

πŸ—ž Sajjad Umar published a new edition about Ruby on Rails - May 2024

🎧 Podcasts

πŸ“½οΈ πŸŽ₯ Videos

Screencasts

πŸŽ₯ Chris Oliver published a new video about Rubygems Trusted Publishing

✍🏾 Articles

What’s new πŸ†•

πŸ†• Andy Croll published an article about Railsconf Detroit 2024: A Co-chair’s Perspective

πŸ†• Mohammad A. Ali published an article about Turbo charge your Ruby Litestack apps using the Fiber Scheduler &YJIT

πŸ†• John Nunemaker published an article featuring RailsConf 2024

πŸ†• Noah Gibbs published an article about Software Engineer Portfolios explaining why software engineers should have a portfolio

πŸ†• Roland Lopez published a new article about Ruby on Rails and the Art of Object-Oriented Design

πŸ†• Krzysztof published an article about Hanami and HTMX - progress bar

πŸ†• Thiago AraΓΊjo Silva published an article How We Used a Custom Enumerator to Fix a Production Problem

πŸ†• Paul Keen published an article on New asserts for testing stopped streams after Ruby on Rails 7.1

πŸ†• Deepak Mahakale published an article on how Rails 8 adds Kamal by default

πŸ†• Jason Swett published a new article about Testing anti-pattern: merged setup data

πŸ†• Justin Toniazzo published an article on Why you should nest modules in Ruby

πŸ†• Lucian Ghinda published an article about Add Binding.break code snippet in RubyMine and VS Code

πŸ†• Mykola Zozuliak published an article about Ruby class pattern to work with API requests with built-in async approach

πŸ†• Gift Egwuenu published an article about April 2024 RubyGems Updates

πŸ•΅οΈ Deep-Dive

πŸ•΅οΈ Radan Skoric published an article on the Hidden feature of Turbo: stream actions inside regular HTML

πŸ•΅οΈ Mathieu Eustachy published an article about Concurrency and parallelism in Ruby

How-TOs πŸ“

πŸ“ Miles published a new article about Track Deployments in Appsignal with Kamal

πŸ“ Hexdevs published a new article about How to RSpec a Jbuilder response from a Rails JSON API

πŸ“ Ganesh K. published a new article about How to build secure APIs with Ruby on Rails

πŸ“ Roland Lopez published a new article about Creating your first Rails Engine

πŸ“ Akshay Khot published an article about How to Access Rails Models in a Rake Task

πŸ“ Thomas Riboulet published an article about Creating Forms in Ruby on Rails with Simple Form

Krzysztof Kamil published an article about Hanami Shrine - file handling in Hanami

Related

Daniel Lemire published an article about Learning from the object-oriented mania

Reply

or to participate.