Image of Lucian Ghinda writing for notes.ghinda.com
Short posts mostly about Ruby and Ruby on Rails. You can find me at : Linkedin, Mastodon, Twitter, Bluesky or for longer posts at allaboutcoding.ghinda.com. Check goodenoughtesting.com if you want to learn to write fewer tests and cover more features. 
Subscribe via RSS here

Short Ruby Edition 129

Short Ruby Newsletter - edition 129 highlights

📅 Events

  • African Ruby Community shared that Ruby Conf Africa opened its Call for Papers for this year event which will took place on 18-19th July.
  • Euruko announced their 2025 Call for Papers is open, seeking talks on Ruby 3.x evolution, the Ruby ecosystem, and Ruby in production for their "The Heart of Code" themed conference
  • Ruby Conf Taiwan announced the date August 9-10 for this year event and more information that will coming soon

👉 All about Code and Ruby

  • Hiroshi Shibata announced the release of Ruby 3.1.7 (the final version of the 3.1 series) and 3.2.8 (starting the security maintenance phase). He also recommended updating your Ruby to 3.3 or 3.4
  • Igor Kasyanchuk published a cheatsheet about Hotwire cheatsheet
  • Oskars Ezerins published LLMs benchmarks - Popular LLM benchmarks for ruby code generation
  • Russ Olsen shared that he and Brandon Weaver are working on a second edition of Eloquent Ruby, maintaining the original structure while updating it for modern Ruby
  • Joe Masilotti announced a new library bridge-components that provides ready-to-use UI components for Hotwire Native applications
    You can find a lot of code samples like Kasper Hansen sharing how to use Module.new to create new namespaces, Hans Schnedlitz sharing you can use emoji routes in Rails while Josh Branchaud noted that \#️⃣ is a valid comment syntax in Ruby, Igor Alexandrov shared a code sample using ActionMailer\#email_address_with_name, Andy Croll shared a beautiful one liners in Ruby used to generate the code used for a T-Shirt and much more Ruby and Rails examples that you can get inspiration from.

Remember to read ️ 📐Thinking about Code where Carmine Paolino shared that by making the transition from Puma, SolidQueue, SolidCable to another stack like Falcon, AsyncCable, AsyncJobAdapter dramatically improved LLM response speeds, Gavin Morrice shared insights on encapsulation, arguing attr_accessor exposes internals and suggests custom methods that validate input, protect state, and separate interface from implementation and much more interesting discussions.

Inside 💡Around code section read about Ruby Central announcing that the RubyGems team is strengthening the platform's foundations with new safety, reliability, and governance policies and Robby Russell asked his community about the wildest use cases of Ruby on Rails they've encountered over the years and got some very interesting and inspiring responses. You should check them out!

🧰 Gems, Libraries, Tools and Updates

  • Alessandro Rodi released Letter Thief, a gem for logging emails in Rails apps that stores them in your database and can open them in development, similar to letter_opener
  • Abdelkader Boudih launched a new gem → mcp_rails_template - A minimal Rails API template for creating MCP servers with robust tool execution capabilities and examples
  • Yorick Jacquin published a new gem fast-mcp → a Ruby Implementation of the Model Context Protocol
  • Julik Tarkhanov created a new gem serve_byte_range -> Utility module for serving HTTP Range responses without buffering
  • HCB announced their open source Rails app hackclub/hcb -> The neobank built for nonprofits
  • Sahil Lavingia announced that flexible is now open source - Payroll & equity for everyone. Look inside app/rails for the Rails app part of flexible
  • Davide Santangelo published a new gem hyll - Hyll provides a robust implementation of the HyperLogLog algorithm, enabling highly accurate cardinality estimation (counting unique items) with minimal memory footprint

You will also find updates on their projects or libraries like Rubocop, solargraph and httparty.

As always, we have more links to newsletters, videos, podcasts, and articles.

Read the full newsletter for free at https://newsletter.shortruby.com/p/edition-129


You have to remain the driver and solution architect

I used Claude Code to refactor a series of tests from Minitest::Mock to the Mocha library this early morning. 

The main reason is that I had certain parts of the tests using Mocha and others utilizing Minitest::Mock. Since other projects I work on use RSpec, I find Mocha to be closer toons in RSpec, which minimizes the context change for me overall. 

I started with a simple example and provided this prompt: 

Go in the test/services/bluesky/save_thread_test.rb and redo the test 'empty result when client returns empty array' to use mocha instead of simple Minitest mock

Here is what Claude Code proposed as a change. It added the line with instance_variable_set (it is not marked here as a diff because I chose 'No' when it asked me to apply, and I'm not sure why it isn't marked).

What is true is that the SaveThread object is not handling dependency injection properly: it instantiates a Bluesky::Client, but it does not accept it during initialization.

Claude Code proposing to use instance_variable_set

So I followed up with: 

Instead of doing instance_variable_set wouldnt it be better to do depedency injection in the SaveThread object?

And I got the following answer:

Claude Code proposing to use class_eval to update the initializer

It’s an interesting solution, but I don't like it for obvious reasons: the object I want to test is also the object that is altered by the test (which goes against the fundamental principles of testing).


Thus, I asked: 

I prefer to change the SaveThread object itself

Notice that it included the client in the initializer, added an attr_reader for it, and also kept the previous memoized method.

Claude Code changes keeping the memoized method and the attr_reader

In my opinion, this type of behavior reinforces the notion that you need to know how you want your code to be structured (which I refer to as code design).

It also seems more important than ever to be able to read a diff and understand the proposed changes. LLMs may improve over time, but at least for now, it appears to me that to ensure good code quality, one must first have enough experience to recognize what good quality is and be able to determine which changes to accept or reject. 


Short Ruby Newsletter - edition 127

Short Ruby Newsletter - edition highlights

This edition was sponsored by Judoscale and was created with the help of Vladut Cosmin


🚀 Launches

  • Adam McCrea launched an exciting new tool for comparing hosting costs of web applications across multiple platforms → PaaS Pricing Calculator
  • Chetan Mittal launched a new book, Mastering Enums in Rails

📅 Events:

  • Kasper Timm Hansen announced a new workshop: Action View-Source Deep-Dive.
  • Ruby Central announced the early bird tickets will go on sale on Wednesday.
  • Euruko announced the opening of their Call for Proposals for EuRuKo 2025
  • Irina Nazarova announced the speakers for the SF Ruby Meet-up happening on 20 March

👉 All about Code and Ruby
There a lot of code samples included; here are just some of them: 

  • InfoSec reported critical vulnerabilities in the ruby-saml gem that allow attackers to bypass authentication, currently an update is available for this gem
  • Ruby on Rails announced a new release 8.0.2
  • Esparta shared his experience of bundle being interrupted during dependency installation while upgrading to Ruby 3.4.x
  • Matt Yoder shared a Ruby puzzle about string-freezing behavior.
  • Vladimir Dementyev showcased how easy it is to run Avo directly in the browser.
  • Peter Solnica shared his discovery that Ruby's byteslice method creates new string instances when operating on frozen, empty strings.
  • Graceful.Dev shared a trick about using filters and map together efficiently.
  • Michael Koper shared a security tip to prevent admin account password resets in Rails. You can discover up to 14 more concrete, ready-to-use code samples the community shares. 

Remember to read ️ 📐Thinking about Code, where Nate Berkopec shared advice on optimizing ActiveRecord database connections by using external poolers and a large pool setting, and Xavier Noria raised a question about Ruby's flat_map method, suggesting map_flat as a more intuitive alternative name. You can also discovere what Errol Schmidt shared their top 5 good and bad findings from Ruby on Rails app reviews based on production applications and many other interesting conversations. 

Inside 💡Around code section Donn Felker shared an interesting business opportunity as he is searching for a co-founder for one of his projects, Remi Mercier asked about questions that people have when starting to work with Minitest, Sourav shared his experience learning Ruby on Rails from a React/Next.js background, posting. 

🧰 Gems, Libraries, Tools and Updates 

  • Mike Perham released version 8 of Sidekiq gem
  • Carmine Paolino announced the release of a new gem RubyLLM. You can also follow the link to read the discussion on Hacker News about this gem (650 points and 165 comments)
  • Sean Gregory published a new gem Hokusai - A Ruby library for authoring GUI applications
  • Bruno announced a new gem Ruberto - A Ruby API wrapper for Uber
  • Brad Gessler announced a new gem superlink: A more powerful path and url generator for Rails
  • Tomasz Kowalewski published a gem memplify - Simplify memory profiling with memplify
  • Zach Morek published an interesting project  DOOM.rb - A Ruby implementation of the classic DOOM game engine, focusing on vanilla accuracy inspired by Chocolate DOOM

You will also find updates on their projects or libraries like Trix, activeagents.ai, Rubocop, Roda, Sitepress, standard, ruby-openai, Rubygems.


As always, we have more links to newsletters, videos, podcasts, and articles. 

Read the full newsletter for free at https://newsletter.shortruby.com/p/edition-127

About vibe coding

I am very close to putting this "vibe coding" phrase into ignore lists. But someone saying that Ruby is not fit for vibe coding made me look into what this term is.

Andrej Karpathy introduced this in a post on social media:

What is vibe coding - original definition

But it seems to have evolved into something that is now described more close to the following definition (source: Wikipedia)


> an inexperienced person describes a problem in a few sentences as a prompt to a large language model (LLM) tuned for coding.

Definition of Vibe coding from Wikipedia


Now let's take a look back at what Andrej wrote and try to add two contexts to this: 

  • He is an expert in LLMs - notice the term expert here
  • Let's focus a bit on some things I marked from his post
Annotated screenshot of the definition of Vibe Coding

Here are some questions I would like to ask myself: 

  • Look at 1️⃣ When he says I just work around it, how close is he to an amateur programmer or someone without any experience in coding? Could it be possible for things to look easy to work around because he has so much experience? 
  • Look at 2️⃣  When he says, "or I ask for random things," how random are those things, and how much of this know-how/experience is he asking for random things?
  • And now let's look at the last part, 3️⃣ - where he says, "I just <...> say stuff," and again, ask yourself when he says stuff to an LLM, how similar are his prompts/queries to a random person without any technical knowledge

This might be an expert blind spot for him and us, as we haven’t considered how much his expertise makes things seem simple. 

I am not saying this cannot happen, but seeing this vibe coding suddenly everywhere triggered my skepticism inside. 
It is just a thought; I am not saying this is not working or is not real. We might be in the beginning of something great. 

A possible advantage for Ruby for LLMs

An interesting point of view about the advantage #Ruby might have when considering AI

"generating equivalent functionality in Ruby costs approximately one-third of what it costs in TypeScript" (source)

Source: https://anykeyh.hashnode.dev/rubys-renaissance-in-the-ai-era

Support tech creators

I'm aware that as developers—or as tech enthusiasts—we're picky about subscribing to newsletters.

Here's the harsh reality:
1) Running a newsletter has some costs.
2) Advertisements are the primary means to cover newsletter costs.
3) A key metric for advertisers is the subscriber count.

There are other metrics involved, and also, for example, in the case of shortruby.com, many who chose to place an ad within it did so also to support the newsletter. Which is amazing, and I am so grateful to them.

I encourage you to subscribe to a newsletter if you enjoy it. 
The same applies to podcasts YouTube channels, or blogs. 

Support the creators when you can. RSS is also a good option; just be aware that it does not appear in the stats.

One great benefit of using Sorbet

One benefit of using Sorbet is that it can make VSCode and Neovim almost on par with RubyMine's excellent behavior of being able to go to definitions and references from almost anywhere to anywhere. It helps so much with debugging and refactoring. 

And that is amazing in a dynamically typed language. 

Trying claude code for the first time with Ruby on Rails

This morning I played a bit with Claude Code and tried it out on a piece of #Ruby that was written in a hurry for a personal project.

I asked the following prompt:

Prompt used for Claude Code

It created a new file that included the previous code and maintained the previous structure with private attr_reader, even though it wasn’t necessary here.

New file created by Claude Code

It then replaced the previous code with a call to the new object.
At least two notes:
- It is not necessary to use require relative since this is a Rails project
- It kept that method with a single call and here, I would have liked to discuss whether to keep it or not

The changes in the existing file

Then it copied the test from the previous big file to this one and added an extra test.
Notice not only here but in multiple files that it does not add new line at the end of the file.

The tests moved to the new file

It then executed the tests and wrote a summary.
I would have liked to have executed the test from the file where the code was extracted to ensure that the tests there still passed. I executed it manually, and it still passed.

Executing tests

The total cost for this operation 29 cents and it took 3 minutes. Well the number of minutes is not real because I stopped multiple times taking screenshots.

Total costs

Sleep can improve your productivity

We probably all know this, but let me remind you—and mostly myself—that getting a good night's sleep is one of the simplest ways to boost productivity.

Add a 30-minute walk in the morning, and you'll likely see a 3.14x or even 7.5x increase, at least. 

You decide!

When posting on Bluesky or Mastodon use hashtags

A gentle reminder: please use #Ruby or #Rails when posting about Ruby or Ruby on Rails on Bluesky and Mastodon.

It helps with content discovery, and the search works much better, IMO when looking for hashtags.

Include Hashtags

Let me add another thought: 

  • I recommend to tag with \#Ruby and \#Rails because Rails uses Ruby :) 
  • There should not be a need to say this out loud, but I discovered a lot of content tagged only with Rails, which says something about how massive Rails is in the Ruby world.

I am approaching this from the perspective of someone who, let's say, just found out about Ruby on Rails and tries to search on Bluesky or Mastodon.

If they search for #Ruby, they should also see #Rails content and get inspired about what they could achieve with it.


Why do I talk here about Bluesky and Mastodon? 
For example, Twitter or Linkedin have their own algorithm to push content, and I am not sure hashtags are any part of it. It seems to me that what matters there is the virality of the post. But if you post on Linkedin or Twitter please do add hash tags there too. 

PS: It works for other topics, too!

How grape-entity works

Someone asked on Reddit a question like:

> Can anyone provide me an informative article on how grape-entity works?

I don't know or not able to find an article that describes how it works.

Whenever I use it, and I have some doubts, I try to read the source code. 

You can start from here:
https://github.com/ruby-grape/grape-entity/blob/master/lib/grape_entity/entity.rb

But all the files in this folder https://github.com/ruby-grape/grape-entity/tree/master/lib/grape_entity are relatively easy to read.

In case you feel like having questions like "How did the entity got that value or what is the source of that value" I would recommend looking into the delegators https://github.com/ruby-grape/grape-entity/tree/master/lib/grape_entity/delegator

Consider carefully when deciding to create an array column in Rails

Think carefully about whether I truly need an array column in Rails or if it's more effective to create it as JSON from the start.

Sooner rather than later, I would like to enrich that column and add some extra information. 

Which will create the need for a 3-stage migration:

  • Add new column while keeping the old one 
  • Execute data migration by generating the new structure in the new column
  • Change the code to use the new column
  • Drop the original column

Before deciding, I should clarify the reasons this will always be an array instead of just assuming it is one. And if there are no good reasons for it maybe it should be a JSON/JSONB column from the start. 

Of course, could be that this should just be a nested model -> but that is a decision to be discussed in another post :)

Twitter transitioned to Scala to continue writing beautiful code

I found this quote in this article about Twitter moving to Scala:

> But he also prefers Scala because it's, well, beautiful. "It's a fuzzy thing. But we like writing beautiful code, code that you're proud of, code that you can show to non-programmers and they get it."

About Scala and writing beautiful code

They chose Scala because they wanted to write "beautiful code." 
I think I can say that Ruby influenced this decision in more ways than one.

Written by Lucian Ghinda - Senior Ruby Developer by day, Curator of Short Ruby Newsletter during weekends