#​657 — June 8, 2023

Read on the Web

Together with  AppSignal logo

Ruby Weekly

Ruby 3.2 Runtime Now Available in AWS Lambda — Ruby was one of the earliest languages to be supported on AWS’s serverless Lambda platform, but has been neglected recently with Ruby 2.7 remaining the latest version with first-class runtime support.. till today! Praveen handily rounds up the benefits of Ruby 3.2 vs 2.7 here (interesting even if you don't use Lambda), notes that cold starts are marginally slower, and explains 2.7 support has been extended till December to enable a smooth transition.

Praveen Koorse (AWS)

Setting up Rails 7 with React, TypeScript, and esbuild — You could use react-rails, but if you want to understand the various parts involved in making the magic happen with bringing React and Rails together, Ryan goes into detail here.

Ryan Bigg

How to Monitor Custom Metrics with AppSignal — Improve your application's critical monitoring data by tracking meaningful metrics to quickly identify and resolve potential issues.

AppSignal sponsor

  • 🧑‍🍳 Cookpad is a Japanese recipe sharing service that has, for many years now, employed Koichi Sasada and Yusuke Endoh of the Ruby core team to work on Ruby. Sadly, that has 🐦 now come to an end as part of broader staff reductions there.

  • 🎤 DHH was on an episode of 37signals' Rework podcast ▶️ talking about two person teams and how 37signals builds its software, which naturally has Ruby and Rails at its heart.

  • ✍️ One of our favorite technical bloggers, Julia Evans, often touches on Ruby related topics and has shared some 'blogging myths' which might help you feel more confident working on your own posts.

  • 😂 Bravo to David Kimura of the Drifting Ruby screencast site for dedicating his 404th episode to ▶️ approaches to displaying error pages in Rails apps.

  • Rails recently merged a PR updating Action View to use HTML5 (as opposed to HTML 4) standards-compliant sanitization. HTML5 support is available in modern versions of Nokogiri (for DOM parsing only) via Nokogiri::HTML5 and the latest release of the Loofah sanitization library supports it now too (in CRuby, but not JRuby).

📕 Tutorials, Articles, and Videos

Four Strategies To Remove Dead Code from a Ruby App — When code has long passed its use-by date, where does it go? Often it sits in your codebase going stale, but there are some strategies you can employ to clear it away with confidence.

Stefanni Brasil and Thiago Araujo

Are You Sure Your has_one Association Really Has One Association?“The Rails has_one API has an unexpected limitation: It does not prevent multiple records from being associated to the parent record.” Steve looks into the problem and how to mitigate it.

Steve Polito

Upgrading from Selenium to Cuprite — While a move to Cuprite (the headless Chrome driver for Capybara) resulted in performance gains, it also introduced some flaky test failures that required a little detective work to fix.

Janko Marohnić

📅 New Security Webinar on June 12th: Securing Your Rails Application — Learn how to stop bad actors and patch attack vectors from industry leaders @mbuckbee and @etagwerker.

FastRuby.io | Secure your Rails App sponsor

A ChatGPT Rails App Optimization Example — It’s early days for using LLMs to help with dev tasks, but this is an interesting example of ChatGPT converting a bloated block of Ruby code into an SQL query that does the same thing. (If you try this for yourself, you may want strong tests in place to verify the results..)

Andrei Kaleshka

A Friday Email Incident at HEY — Like all of us, the folks at 37signals run into technical incidents too. Here’s one that affected their HEY email service. Ruby is only vaguely involved, but it’s interesting to see how they patched over the problem temporarily.

Jorge Manrubia (37signals)

Deploying a Sinatra App to Render.com
Barry Hess

What to Do When You Need a button_to Within a Form in Rails
Benito Serna

Practical Stimulus: Capturing User Input
Akshay Khot

🛠 Code & Tools

Karafka 2.1: Multi-Threaded Kafka Processing Framework — Apache Kafka is a distributed messaging system and Karafka opens it up to the Ruby world very well with ActiveJob backend support, a built-in Web UI, parallel processing supporting, dead letter queue functionality, and more. GitHub repo.

Maciej Mensfeld

typed_params: An Alternative to Rails Strong Parameters — A DSL for defining structured and strongly-typed controller parameter schemas for Rails APIs. (Extracted from a large, established app.)

Keygen

Try gem install trycourier & Plug in Your Transactional Email API — This gem helps you send notifications the easy way. Call one API with Courier.com the Customer Notification Platform.

Courier.com sponsor

LangChain.rb: Build LLM-Backed Ruby Apps — Inspired by a popular, similarly named Python system, the goal is to provide a flexible abstraction on top of modern AI tools, databases and ML systems for building LLM workflows.

Andrei Bondarev et al.

Spyke 7.1: Interact with REST Services in ActiveRecord Style — Uses Faraday under the hood, but gives you some AR-like niceties on top like scopes, log output, validations, and even associations (the examples are helpful to understand that part).

Jens Balvig

PluckInBatches: AR's in_batches Plus pluck — Combines the idea of dealing with records in batches and only selecting certain columns (as pluck allows) into a single call and claims to be faster, too.

fatkodima

Jobs

Full Stack Engineer, Ruby & React (’s-Hertogenbosch, Netherlands) — We help companies with fast & simple business loans. Own projects, work closely with stakeholders. No suits, just impactful code.
Floryn

Find Ruby Jobs with Hired — Hired makes job hunting easy-instead of chasing recruiters, companies approach you with salary details up front. Create a free profile now.
Hired