---
title: "Ditching Active Record callbacks"
publication: "Ruby Weekly"
issue: 618
published_at: "2022-09-01"
canonical_url: "https://rubyweekly.com/issues/618"
---

Plus CSV's new generate_lines method, an expressive query DSL for Active Record, and integrating Sidekiq with Hanami apps. |        

#​618 — September 1, 2022 

[Read on the Web](https://rubyweekly.com/issues/618) 🇺🇦   

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/rmoomfkrlaaruboyixpy.jpg)](https://github.blog/2022-08-25-introducing-trilogy-a-new-database-adapter-for-ruby-on-rails/)  

[Trilogy: A New Database Adapter for MySQL from GitHub](https://github.blog/2022-08-25-introducing-trilogy-a-new-database-adapter-for-ruby-on-rails/) — GitHub uses Trilogy for connecting its Rails apps to ‘MySQL-compatible’ (e.g. MariaDB) database servers. Why use it over mysql2? It has no dependency on libmysqlclient or similar, so it can be easier to install and deploy, and it boasts improved performance under heavy loads. Compatibility varies, so take care and be sure to test if it will work for you. 

Matthew Draper (GitHub)   

[Heroku’s Next Chapter, Says Bye to Its Free Plans](https://blog.heroku.com/next-chapter) — Heroku has played a huge role in the Ruby and Rails space over the years, but there’s recently been a lot of conjecture around its future. Salesforce (its owner) has responded with a public roadmap.. which sadly includes the discontinuation of its wildly popular free plans by the end of the year, so if you have apps on Heroku, it’s worth checking in on how they’ll fare. 

Bob Wise (Heroku)   [![\](https://copm.s3.amazonaws.com/1969f379.png)](https://www.courier.com/blog/series-b-make-notifications-delightful/?utm_campaign=demand-gen&utm_source=email&utm_medium=ruby-weekly-9-1&utm_content=fundraise-blog) 

[GV (Google Ventures) Invests $35m into Ruby Notification Infrastructure](https://www.courier.com/blog/series-b-make-notifications-delightful/?utm_campaign=demand-gen&utm_source=email&utm_medium=ruby-weekly-9-1&utm_content=fundraise-blog) — A need for notification management systems has grown rapidly as software companies realize this critical user experience. Customizable channel preferences, and cross-channel audit logging are a necessity in the privacy era. 

Courier sponsor   

[Ditching Active Record Callbacks](https://engineeringblog.wonolo.com/ditching-active-record-callbacks) — As useful as they can be, Active Record callbacks are a frequent pain point for Rails developers because they can be easily overlooked when debugging. After ending up in a tangle of callbacks, Jeremy’s team came up with a _different_ approach (that I’m not that keen on myself, but you might!) 

Jeremy Williams   

**Quick Bits:** 

- There's been some recent progress on a long-time [proposal to introduce native value objects to Ruby.](https://bugs.ruby-lang.org/issues/16122) Matz has made [some suggestions](https://bugs.ruby-lang.org/issues/16122#note-49) as to how it might be implemented.
- [v3.2.5](https://github.com/ruby/csv/blob/master/NEWS.md#325---2022-08-26) of Ruby's `csv` library is out and adds a new `CSV.generate_lines` method – feed it an array of arrays and you get back a string of CSV. This is very useful!
- Over on Reddit, someone shared [▶️ a video of a DragonRuby powered 4K rendering example,](https://www.reddit.com/r/ruby/comments/x064qp/ruby_rendering_4k_scenes_with_physics_at_60fps/) complete with (basic) physics ([source code](https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/tree/master/samples/99_genre_platformer/the_little_probe)). If you've not seen it before, [DragonRuby](https://dragonruby.org/) is an interesting mruby-based Ruby runtime aimed at 2D game development.  

📖 Articles, Stories & Videos  

[The What, the Why, and the How of Bloom Filters](https://www.ombulabs.com/blog/systemdesign/ruby/bloom-filter-and-what-makes-them-special.html) — [Bloom filters](https://en.wikipedia.org/wiki/Bloom_filter) are a very interesting type of data structure that allow you to efficiently determine whether something is definitely _not_ a member of a set or, to a certain level of probability, _is_ a member of a set. They’re not difficult to implement either, as we see here. 

Rishi Jain   

[Automate GitHub API Calls with Ruby, Keyboard Maestro, and 1Password CLI](https://www.moncefbelyamani.com/automate-github-api-calls-with-ruby-keyboard-maestro-and-1password-cli/) — An interesting combination of tools come together here, with Ruby automating things at the heart. There are better but more complex ways to solve Moncef’s problem but it’s a neat bit of [‘flintstoning’](https://stackingthebricks.com/the-fine-art-of-flintstoning/) that he’s done here. 

Moncef Belyamani   

[Migrating a Rails App from Webpack to esbuild](https://blog.arkency.com/how-i-migrated-a-rails-app-from-webpack-to-esbuild-and-got-smaller-and-faster-js-builds/) — Jakub explains how he’s migrated a project with over 300k lines of JavaScript code(!) from Webpack 4 to esbuild and, perhaps unsurprisingly, got _far_ faster builds in the process. 

Jakub Kosinski   

[Join the Collaboration Community: Network and Do More of What You Love](https://www.polywork.com/?utm_source=newsletter&utm_medium=cooperpress&utm_campaign=ruby3) — Collaborate with other professionals on side projects, podcasting, beta-testing, co-founding, and more. 

Polywork sponsor   

[Stateless Forms with the Rails Attributes API](https://blog.testdouble.com/posts/2022-08-30-stateless-forms-with-the-rails-attributes-api/) — If you’ve ever used a non-ActiveModel-based form in Rails before, you’ll appreciate this dive into the Attributes API, its use cases, and several examples of how to use it with real-world forms. 

Justin Searls (Test Double)   

▶[Discussing Postgres with Andrew Atkinson](https://www.codewithjason.com/podcast/11223850-160-postgresql-with-andrew-atkinson/) — Ruby-flavored Postgres database discussion covering areas like constraints, catching unsafe migrations, and analyzing query plans. 

Code with Jason Podcast podcast   

💡 If you're a Postgres user, be sure to check out [our Postgres newsletter.](https://postgresweekly.com/)  

[Integrating Sidekiq with Hanami Apps](https://hanamimastery.com/episodes/27-integrate-sidekiq-with-hanami) — Sidekiq and Rails live together like bread and butter, but what about Hanami? It’s pretty straightforward too. 

Hanami Mastery   

▶[The One About Layoffs](https://www.therubyonrailspodcast.com/433) — Brittany Martin and Brian Mariani tackle a difficult topic, but one that’s increasingly affecting developers in turbulent times. They share their own personal tales and try to offer some silver linings too. 

The Ruby on Rails Podcast podcast   

[Managing Rails App Business Logic with ActiveInteraction](https://www.shakacode.com/blog/manage-rails-app-business-logic-using-activeInteraction-gem/) — [ActiveInteraction](https://github.com/AaronLasseigne/active_interaction) is a service object implementation for Rails apps. 
Alkesh Ghorpade   

[The Mysterious Life of `public`, `private`, and `protected`](https://paweldabrowski.com/articles/public-private-and-protected-in-ruby) 
Paweł Dąbrowski  

🛠 Code & Tools 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/weyglgcm0shtvu4f2a4j.jpg)](https://github.com/rzane/baby_squeel)  

[BabySqueel 2.0: An Expressive Query DSL for Active Record](https://github.com/rzane/baby_squeel) — _Squeel_ was a project many years ago that monkeypatched Arel to enable the writing of more expressive queries. BabySqueel brings similar ideas to Active Record but with less monkeypatching. So if you’d rather write `Post.where.has { created_at >= 2.weeks.ago }` than the longer Arel-based equivalent.. give it a look. 

Ray Zane   

[Ruby Units: A Unit Handling Library](https://github.com/olbrich/ruby-units) — Designed to simplify (and provide a structure around) the handling of units for scientific calculations. 

Kevin Olbrich   

[Don’t Let Your Issue Tracker Be a Four-Letter Word. Use Shortcut](https://shortcut.com/?utm_source=cooperRubyWeekly&utm_medium=spon_nl&utm_campaign=prospecting&utm_content=fourletter) 

Shortcut (formerly Clubhouse.io) sponsor   

[Shale 0.8: Object Mapper and Serializer for XML, JSON, TOML and YAML](https://www.shalerb.org/releases.html#v080) — This latest release reintroduces Ruby 2.6 support (mostly for JRuby’s benefit) and you can now group mappings via a `group` block. 

Kamil Giszczak   

**⚡️ QUICK RELEASES:** 

[parallel_tests 3.12](https://github.com/grosser/parallel_tests) – More cores == faster testing.
 [Que 2.2](https://github.com/que-rb/que) – Ruby job queue that uses Postgres's advisory locks.
 [Strong Migrations 1.3](https://github.com/ankane/strong_migrations) – Catch unsafe migrations in dev.
 [SyntaxTree 3.5](https://github.com/ruby-syntax-tree/syntax_tree) – Fast Ruby parser and formatter.
 [Octokit.rb 5.4](https://github.com/octokit/octokit.rb) – Ruby toolkit for the GitHub API.
 [Tomo 1.13](https://github.com/mattbrictson/tomo) – A CLI for deploying Rails apps.
 [AcidicJob 0.8.5](https://github.com/fractaledmind/acidic_job) – Idempotent operations for ActiveJob or Sidekiq.     

Jobs  

[TravelJoy | Engineer #9 | Full-Stack | Remote in USA | Full-Time](https://join.tjoy.io/rw-eng9) — TravelJoy is the market network for leisure travel. Thousands of travel agents love and depend on our product every day. 
TravelJoy - Bring the joy back into travel planning   

[Find Ruby Jobs 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           

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

[Change your email](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   

Other weekly newsletters we publish include [Postgres Weekly](https://postgresweekly.com/), [React Status](https://react.statuscode.com/), [Frontend Focus](https://frontendfoc.us/), and [JavaScript Weekly](https://javascriptweekly.com/).
