- Short Ruby Newsletter
- Posts
- Short Ruby News - Edition #91
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:
π 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)
More content: π π π§ π₯ βπΎ (articles, podcasts, videos, newsletters)
π Launches
π Vitaly Slobodin launched Ruby LSP - IntelliJ IDEs Plugin | Marketplace
π 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:
π Seth A. Roby shared a gist containing a class that will use your existing FactoryBot factories to rewrite the data already in the db, keeping the associations and structure but replacing the content.
π 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:
Check out his blog on Comparing SQLite based Rails cache stores:
π‘ Josh Pigford wishes for Rails to have a quick auth generator
Stephen Margheim shared an example of minimal authentication requirements for Rails app as a reply
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:
evil-seed - A Gem for creating partial anonymized dumps of your database using your app model relations
forceps - Copy active record models from remote databases
scrubbing section from High performance PostgreSQL for Rails book
rails_anonymizer - Anonymize your DB with Rails
pgsync - Sync data from one Postgres database to another
postgresql_anonymizer - PostgreSQL extension
db_subsetter - Extract a subset of a relational database for use in development or testing
wipe_out - Library for removing and clearing data in Rails ActiveRecord models.
active_record_anonymizer - A ruby gem to anonymize your ActiveRecord attributes with ease
β€οΈ 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
π Dr Nic Williams announced a new gem promptcraft: Try new system prompts on your AI conversations. Over and over until you're happy.
π Harrison Broadbent announced a new project Ruby-middleman-tailwind-starter-blog: A Middleman blog template configured with TailwindCSS, markdown parsing, code highlighting, a sitemap.xml and more
π Svyatoslav Kryukov announced a new gem turbo-mount: Use React, Vue, Svelte, and other components with Hotwire
π Brooke Kuhlmann published a new gem called irb-kit
π§° Updates
π§° Ruby On Rails announced a new version of Rails Versions 7.0.8.2, and 7.1.3.3 have been released!
π§° Xavier Noria announced a new version of Zeitwerk:
π§° Vinicius Stock announced a new version of Support instance variables for definition, hover, completion and workspace symbols by vinistock Β· Pull Request #2042 Β· Shopify/ruby-lsp
π§° Stimulus Reflex announced a new version of StimulusReflex v3.5.0
π§° Koichi Ito announced a new version of Release RuboCop Rails 2.25.0 Β· rubocop/rubocop-rails
π§° 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
π€ 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: π π π§ π₯ βπΎ
Marco Roth published their slides about The Hotwire Landscape After Turbo 8 @ Helvetic Ruby 2024, Zurich
Soutaro Matsumoto shared their slides from RubyKaigi 2024 - Embedding it into Ruby code
Chris Oliver published their slides about Crafting Rails Plugins
Manu J published their slides about Look Ma, No Background Jobs - A peek into the Async future
Mari Imaizumi published their slides about Exploring Reline: Enhancing Command Line Usability
Ivo Anjo published their slides about RubyKaigi 2024 - Optimizing Ruby: Building an Always-On Production Profiler
Jeremy Evans published their slides about Reducing Implicit Allocations During Method Calling
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
Hasumi Hitoshi published their slides about Unlock The Universal Parsers: A New PicoRuby Compiler
Benoit Daloze published their slides about From Interpreting C Extensions to Compiling Them
Soutaro Matsumoto published their slides about Embedding it into Ruby code
Takashi Kokubun published their slides about YJIT Makes Rails 1.7x faster / RubyKaigi 2024
Hiroya Fujinami published their slides about RubyKaigi 2024 - Make Your Own Regex Engine!
Yuichiro Kaneko published their slides about RubyKaigi 2024 - The grand strategy of Ruby Parser (Day1)
Vladimir Dementyev published their slides about Ruby Mixology 101: adding shots of PHP, Elixir, and more by Evil Martians
π Newsletters
π Ruby On Rails published a new edition about Start of Rails 8 development, 7.0.8.2 & 7.1.3.3 released, Kamal by default, and lots more!
π 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
π§ Andrew Atkinson published a new podcast 220 - Sin City Ruby 2024 Recap with Andrew Atkinson - The Code with Jason Podcast
π§ The Bike Shed published a new podcast The Bike Shed: 426: Bringing "Our Selves" to Work
π§ Indie Rails published a new podcast IndieRails | Tom Rossi - Building Products with a Buzz
π§ Ruby on Rails Podcast published a new episode The Ruby on Rails Podcast Episode 515: Livestreaming Code On Twitch with Rachael Wright-Munn
π½οΈ π₯ Videos
Screencasts
π₯ Jason Swett published a new video about Adding Test Output Streaming - Live Coding on SaturnCI
π₯ Sebastian Wilgosz published a new video about Extracting logic from templates with Hanami Views
π₯ 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
π Prasanth Chaduvula published an article about Ruby 3.4, Range#size Now Raises TypeError If The Range Is Not Iterable and about Ruby 3.4, No More TypeError With **nil As It Is Treated As An Empty Hash.
π 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
π Paul Sadauskas published an article about Referencing Stimulus Controllers as ViewComponent Sidecar Files with Propshaft Importmaps
π 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