---
title: "GitHub brings cross-cluster associations to Rails 7"
publication: "Ruby Weekly"
issue: 561
published_at: "2021-07-15"
canonical_url: "https://rubyweekly.com/issues/561"
---

Plus Roda gets faster, tracking memory leaks, and Chartkick gets a nice update. |        

#​561 — July 15, 2021 

[Read on the Web](https://rubyweekly.com/issues/561)    

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/tepumwkom5lxxl6uyxp2.jpg)](https://github.blog/2021-07-12-adding-support-cross-cluster-associations-rails-7/)  

[Adding Support for Cross-Cluster Associations to Rails 7](https://github.blog/2021-07-12-adding-support-cross-cluster-associations-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](https://www.sitepoint.com/ruby-version-managers-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   [![\](https://copm.s3.amazonaws.com/bf57e5c3.png)](https://dashboard.redisgreen.net/rubyweekly) 

[Fast Redis Hosting and Analytics](https://dashboard.redisgreen.net/rubyweekly) — RedisGreen databases include seamless online upgrades, SSL encryption, key size tracking, memory mapping, and more. 

RedisGreen sponsor   

[Refactoring Your Rails App with Service Objects](https://www.honeybadger.io/blog/refactor-ruby-rails-service-object/) — 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   

**IN BRIEF:** 

- The new version of Roda [boasts 50% faster routing](https://twitter.com/jeremyevans0/status/1414613471262494723).
- [RubyGems 3.2.33](https://blog.rubygems.org/2021/07/09/3.2.23-released.html) has been released.
- [Passenger 6.0.10](https://blog.phusion.nl/2021/07/14/passenger-6-0-10/), the latest version of the popular app server, has been released.   

[A Rubyist's Walk Along the C-side (Part 5): Variables](https://blog.peterzhu.ca/ruby-c-ext-part-5/) — 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     

Jobs  

[Hint is Hiring](https://hint.io/careers) — We are on a mission to help all software teams reach their full potential. You can help. 
Hint   

[Ruby on Rails Engineer](https://www.linkedin.com/jobs/view/2640746135/?refId=lHH7j%2Ft0i13w3BZ1EARPvQ%3D%3D&trackingId=4op9yMUBG3E%2BnoOOjruNrg%3D%3D) — 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. 
Haku   

[Find a Job Through Hired](https://hired.com/join/?utm_source=newsletter&utm_medium=sponsor&utm_campaign=%28b2c%29%28l-all%29%28r-all%29%28cooper-rubyweekly%29&utm_content=find-your-next-job) — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers. 
Hired    

📕 Articles & Tutorials  

[Tracking a Ruby Memory Leak in 2021](https://medium.com/klaxit-techblog/tracking-a-ruby-memory-leak-in-2021-9eb56575f731) — 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. 

Ulysse BUONOMO   

[Let's Read _Eloquent Ruby_: Chapter 1](https://dev.to/baweaver/let-s-read-eloquent-ruby-ch-1-g13) — 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](https://fpsvogel.com/posts/2021/build-a-blog-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](https://pganalyze.com/ebooks/efficient-search-in-rails-with-postgres?utm_source=RubyWeeklySecondary07152021) 

pganalyze sponsor   

[Active Record Encryption](https://hint.io/blog/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. 

Hint   

[Gems, Plugins, Engines, and Mountable Engines: 4 Ways to Make a Gem](https://existentialmutt.com/2021/07/01/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](https://jemma.dev/blog/nhl-time-on-ice-21) — A fun visualization built after using Ruby to [scrape the NHL data](https://github.com/jemmaissroff/hockey) and bring it into a Neo4j database to visualize. 

Jemma Issroff   

[How to Have a Productive Programming Day](https://www.codewithjason.com/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](https://connorshea.gitlab.io/blog/how-i-write-and-maintain-type-sigs-in-my-rails-app-with-sorbet.html) 
Connor Shea   

[Complex Ruby Transformations Made Simple with `Dry::Transformer`](https://hanamimastery.com/episodes/6-complex-ruby-data-transformations-made-simple) 
Hanami Mastery  

🛠 Code & Tools 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/nzmaqm8cexb93itwxysp.jpg)](https://chartkick.com/)   

[Chartkick 4: Beautiful JavaScript Charts in One Line of Ruby](https://chartkick.com/) — 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](https://github.com/ankane/chartkick#upgrading) if you used previous versions. [GitHub repo](https://github.com/ankane/chartkick). 

Andrew Kane   

[TensorFlow 0.2.0: Bringing the Machine Learning Platform to Ruby](https://github.com/ankane/tensorflow) — Uses the C API of [the popular ML toolkit](https://www.tensorflow.org/) under the hood. 0.2.0 adds support for TensorFlow 2.5. 

Andrew Kane   

[Deploy with Confidence and Be Your Team's DevOps Hero 🦸](https://www.honeybadger.io/for/ruby/?utm_source=rubyweekly&utm_medium=email&utm_campaign=ruby) — 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](https://github.com/pat/gutentag) — 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](https://github.com/pawurb/rails-pg-extras) — 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](https://github.com/pawurb/ruby-pg-extras) too. 

Paweł Urbanek   

[Closure Tree: Make Active Record Models Support Tree Hierarchies](https://github.com/ClosureTree/closure_tree) 
Matthew McEachen   

[svgeez: Gem for Automatically Generating an SVG Sprite from a Folder of SVG Icons](https://github.com/jgarber623/svgeez) 
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: 

```
true.public_methods
=> [:===, :^, :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`. 

```
true.class.ancestors
=> [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. 

```
true.public_methods(false)
=> [:===, :^, :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](https://twitter.com/jemmaissroff).          

Curated by [Peter Cooper](https://twitter.com/peterc), [Glenn Goodrich](https://twitter.com/ruprict) and [Cooperpress](https://cooperpress.com/). 

[Change your email address](https://rubyweekly.com/edit_subscription/*|UID|*) or[Stop getting this newsletter](https://rubyweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
