#​561 — July 15, 2021

Read on the Web

Ruby Weekly

Adding Support for Cross-Cluster Associations to Rails 7 — Engineers at GitHub have been working on a new Rails feature coming in Rails 7.0: support for handling associations across database clusters. We also get to learn GitHub uses 30 databases (15 primaries and 15 replicas) with its Rails monolith.

Eileen M. Uchitelle (GitHub)

A Comparison of Ruby Version Managers for macOS — You’ve likely heard of most of the managers here (RVM, rbenv, chruby, maybe asdf) but Frum (Rust-based) was new to us. Each manager is briefly explained here along with the author’s personal pick.

Daniel Kehoe

Fast Redis Hosting and Analytics — RedisGreen databases include seamless online upgrades, SSL encryption, key size tracking, memory mapping, and more.

RedisGreen sponsor

Refactoring Your Rails App with Service Objects — Even with the best intentions, Rails apps can become unwieldy over time with features added on here and there. Refactoring to using service objects can help break things up and improve maintainability going forward.

Godwin Ekuma


A Rubyist's Walk Along the C-side (Part 5): Variables — The latest outing in Peter Zhu’s series on writing Ruby extensions in C. This time he covers reading and writing to various types of variable and constant.

Peter Zhu


Hint is Hiring — We are on a mission to help all software teams reach their full potential. You can help.

Ruby on Rails Engineer — We’re seeking an engineer to join our growing team in Miami to help develop new features and product offerings for our event technology platform.

Find a Job Through Hired — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers.

📕 Articles & Tutorials

Tracking a Ruby Memory Leak in 2021 — Think you have a memory leak? Are you using the “better” allocator? Maybe it’s just bloat in one of your gem dependencies. Nope? Use some community tools to hunt it down and plug it.


Let's Read Eloquent Ruby: Chapter 1 — There’s so much knowledge and wisdom in books that I think the more readalongs like this the better.

Brandon Weaver

Build a Static Site in Ruby with Bridgetown — Felipe creates a real static site with plugins for SEO, Turbo, Stimulus, and more. Also, I didn’t realize Bridgetown started as a branch from Jekyll.

Felipe Vogel

Free eBook: Efficient Search in Rails with Postgres

pganalyze sponsor

Active Record Encryption — A deeper dive into the new AR encrypts functionality coming in Rails 7 where you’ll learn about deterministic vs non-deterministic encryption and the limitations of this new addition.


Gems, Plugins, Engines, and Mountable Engines: 4 Ways to Make a Gem — This is a quick guide whose most valuable info might be when to use each of the four options. I am not sure if I’ve ever seen this in one spot before.

Rafe Rosen

NHL Time on Ice Visualizations for the 2020-2021 Season — A fun visualization built after using Ruby to scrape the NHL data and bring it into a Neo4j database to visualize.

Jemma Issroff

How to Have a Productive Programming Day — This isn’t Ruby specific, of course.

Jason Swett

How I Write and Maintain Type Signatures in My Rails App with Sorbet
Connor Shea

Complex Ruby Transformations Made Simple with Dry::Transformer
Hanami Mastery

🛠 Code & Tools

Chartkick 4: Beautiful JavaScript Charts in One Line of Ruby — This has been around a long time and seems to get a major update each year. Support for the latest Ruby and Rails versions lands in 4.0. Here’s how to upgrade if you used previous versions. GitHub repo.

Andrew Kane

TensorFlow 0.2.0: Bringing the Machine Learning Platform to Ruby — Uses the C API of the popular ML toolkit under the hood. 0.2.0 adds support for TensorFlow 2.5.

Andrew Kane

Deploy with Confidence and Be Your Team's DevOps Hero 🦸 — Exception, uptime, and cron monitoring, all in one place — and easily installed in your web app in minutes.

Honeybadger sponsor

Gutentag: A Simple, Solid Tagging Extension for ActiveRecord — It seems to be the week for very old libraries getting updates. v2.6.0 adds support for querying for objects that match no tags.

Pat Allan

rails-pg-extras 2.0: Postgres Performance Insights for Ruby and Rails — Ruby on Rails developer? This plugin lets you get quick info about locks, index usage, buffer cache hit ratios, vacuum stats and more. There’s a pure Ruby (non Rails) version too.

Paweł Urbanek

Closure Tree: Make Active Record Models Support Tree Hierarchies
Matthew McEachen

svgeez: Gem for Automatically Generating an SVG Sprite from a Folder of SVG Icons
Jason Garber

💡 Tip of the Week

Object#public_methods takes a boolean parameter

Often when learning about an object, it can be useful to see the methods available to call on the object. I find this helpful when debugging, using a new gem, or simply looking to learn more about an object.

Luckily, Ruby exposes Object#public_methods, Object#protected_methods and Object#private_methods, all of which return a list of symbols representing the names of methods defined on an object. For example, if we wanted to see the public methods defined on true, we could do:

=> [:===, :^, :inspect, :to_s, :&, :|,
:taint, :tainted?, :untaint, :untrust,
:untrusted?, :trust, :methods,
:singleton_methods, :protected_methods,
:private_methods, :public_methods...

  ... many many more! ...
..., :instance_exec, :__send__]

There are 61 many public methods, quite a lot! This isn't because there are many methods defined explicitly on TrueClass itself, but rather because of all the methods defined on ancestors of TrueClass.

=> [TrueClass, Object,
    Kernel, BasicObject]

This brings us to the crux of this week's tip. Object#public_methods, Object#protected_methods and Object#private_methods all take an optional boolean parameter denoting whether to include methods defined on ancestors. This means if we pass in false to Object#public_methods, we should see only the methods in the receiver.

=> [:===, :^, :inspect, :to_s, :&, :|]

This is a much more comprehensible list, and more helpful when looking to learn about the nuances of a specific object.

This week’s tip was written by Jemma Issroff.