#​660 — June 29, 2023

Read on the Web

Together with  pgAnalyze

Ruby Weekly

Making SQLite Extensions gem install-able in Ruby — There isn’t an obvious ‘big story’ this week, so I want to shine a spotlight on SQLite genius Alex Garcia. He’s created many interesting SQLite extensions to add regexp support, HTTP request support, vector search, and more, but if you wanted to use them from Ruby, it’s been difficult till now, but 12 SQLite extensions are now just a gem install away..

Alex Garcia

💡 An interesting consequence of this is opening up a simple, local way to work with vector data and vector distance queries, as are useful in modern ML/LLM projects. Here's an example of that in Python, but I'm working up a Ruby example right now..

Keeping Your Apps More Secure with Bundler — Bundler includes several security features and this post looks at a couple of them: bundler audit for finding dependencies with known vulnerabilities, and bundler outdated to ensure you are on the latest versions.

Thomas Riboulet (AppSignal)

Free eBook: Advanced Database Programming with Rails and Postgres — Learn about subqueries, materialized views, and custom data types in Postgres and Rails. We walk through realistic real-life examples, translating first into SQL, and then into Rails code. Every example comes with source code to follow along.

pganalyze sponsor

Open Sourcing Shopify’s Ruby Builds — With one of the biggest Ruby deployments in the world, it’s no surprise Shopify has their own variant of CRuby. If you want to copy their approach, they’ve released shopify-ruby-definitions, a set of ruby-build definitions for their specially tweaked Ruby fork. They also explain why they have to do this rather than run against Ruby head.

Peter Zhu

How To Use 37signals’s MRSK with AWS and GitHubMRSK is DHH’s new(ish) Ruby-based orchestration tool for deploying containerized apps. This post digs into the details of setting it up (including a Dockerfile if your Rails app doesn’t have one) and getting it working with GitHub Actions.

Alexandrov and Masiutin

💡 While MRSK is particularly at home with Rails 7, you can get it to work deploying older Rails 6 apps too.

  • ⚠️ The core Ruby team has released a new version of URI to resolve a ReDoS issue. Expect to see a swathe of gem updates as it's a common dependency.

  • 👏 Congratulations to 🐦 Kevin Newton and Jemma Issroff for being accepted as the Ruby core team's newest members. (If Jemma's name seems familiar to you, she used to write our Tip of the Week feature.)

  • 🌸 Hanami 2.1.0 beta1 has been released, and as is typical for Hanami, they sneak a big development into a minor-sounding release with a new, more powerful view system.

  • 📅 Rails World is a new Rails conference taking place in October in Amsterdam, but if you didn't get on their mailing list in time, you won't be going: all the tickets sold out in 45 minutes, as DHH explains in his typically modest style 😆

  • 🤖 JetBrains has released EAP6 of RubyMine 2023.2 introducing a new 'AI assistant' to the popular commercial IDE. If you're a user, they've also released a post showing off how to master RubyMine's new UI.

  • 👑 In hosting platform Fly․io's announcement about raising lotsa money, they joked that AWS's us-east-1 region contains "so many Rails apps that one of them was elected to the county Board of Supervisors." 😆

📕 Tutorials, Articles, and Videos

How to Split a List into Multiple Equal Partseach_slice iterates over enumerable objects in chunks of a defined length (which you can turn into an array with #to_a). Rails also offers in_groups_of. While each_slice is quite a commonly used Enumerable method, the Enumerable docs are well worth an occasional browse – I’m always reminded of a few interesting ones I haven’t used.

Akshay Khot

Let's Build a Webapp Without Rails — Frameworks and libraries like Rails, Hamami, and even Sinatra do a lot behind the scenes to help us build webapps in Ruby, but what’s going on behind the scenes? Akshay takes a quick look.

Akshay Khot

Optimize Memory and Database Queries in Ruby with Scout — Pinpoint performance issues with Scout's tracing logic. Fix problems before they impact customers with detailed backtraces.

Scout APM sponsor

Vectors are the New JSON in Postgres — When NoSQL was becoming popular, Postgres smartly added native JSON support and has, in time, built up numerous ways to work with it that rival most NoSQL efforts. Fast forward several years and ML and LLM embeddings are now making vectors the data structure du jour and Postgres is stepping up again. (Notably via pgvector, an extension largely built by Ruby’s own Andrew Kane, well known for his tireless work improving Ruby's machine learning ecosystem.)

Jonathan Katz

... Range Literals and Their Effect on Active Record Queries — If you’re guessing this has much to do with which parts of the range are included or excluded in the queries, you’re right.

Lucian Ghinda

Improve Your GitHub Workflow with Better Repository Defaults — Some opinionated suggestions to enhance your GitHub repo experience.

Matt Brictson

If You Liked Shoes, You'll Love Glimmer — The options for building GUI apps in Ruby are only continuing to improve.

Andy Maleh

Using Rails 7.1's Rails.env.local? — A quick way to tell if you’re in a non-production environment.

Vipul A M

Tips on Customizing the Rails Console with .irbrc
Greg Molnar

🛠 Code & Tools

Better HTML: HTML-Aware ERB for Rails — You can generally render almost anything with an ERB template, but Better HTML introduces a little more control when it comes to HTML with runtime checks to restrict syntax, prevent certain types of interpolation, and being able to only insert expressions into script tags rather than statements/conditionals.

Shopify

Fixed Price Monthly Code Maintenance for Rails Apps — No time to do those small but critical updates and features? CodeCare will take care of necessary tweaks, bug fixes, upgrades and ongoing improvements for your app.

reinteractive / CodeCare sponsor

VCR 6.2: Record Your Test Suite's HTTP Interactions and Replay Them — A long standing library for recording HTTP interactions and replaying them during test runs. Following 6.1 by over a year years, 6.2 is principally a release with fixes and dependency updates.

VCR

Jobs

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

🥰 Love is in the air?

🍏  A Love Letter to Objective C! — A curious 'love letter' that seems framed more as a “Ruby is fantastic, and Objective C is tolerable” comparison to me, but it’s interesting to see how a Rubyist looks at the feature-set of a quite different and farMoreVerbose:yes:really language. Picking up another language is rarely a bad idea, though.

Ryan Krug