#​595 — March 17, 2022

Read on the Web

Ruby Weekly

Ruby on Whales: Dockerizing Ruby and Rails Development — There a boatload (ha!) of articles on ‘dockerizing’ Rails apps, but this newly updated one is very good and results in a nice setup, specifically for development rather than production. Plus, they’ve added a template via RailsBytes to get you using it.

Vladimir Dementyev

An Update on WebAssembly/WASI Support in Ruby — The author is both a committer to Ruby and Swift and is working on WebAssembly support in both spheres. This post presents a summary of recent progress made to bring native WebAssembly and WASI support to Ruby – likely to land in Ruby 3.2.

Yuta Saito

The Best Deployment Tool for Rails — Deploy Rails apps on any cloud, with native support for Rails conventions, full databases support, replication & backups, powerful access management & traffic control features. Try it today for free with an extra $100 in free credits with the code: RubyWeekly!

Cloud 66 sponsor

The Perils of Parallel Testing in Rails — Parallel testing seems like a simple solution to speeding up your tests (run more tests at once == faster, no?) but there are considerations and gotchas, and knowing them can help you get the biggest bang for your parallel buck.

Hans-Jörg Schnedlitz (AppSignal)

IN BRIEF:

  • Brad Gessler is keen to share the value of using bundle add rather than manually adding a gem to your Gemfile, and it looks like this recommendation is going straight into the boilerplate docs generated by Bundler's bundle gem soon.

  • 🇺🇦 Ukrainian Rubyist Victor Shepelev remains close to the danger of Russia's invasion of Ukraine and reminds us of the peril both he and his country are in.

  • Rails 5.2.7 (a very old branch – 5.2 came out in 2018) has been released to restore support for Ruby 2.2 that had been broken. In related 'old version' news, Rails 6.1.5 has been released too.

Jobs

Backend Engineer | Remote within CET (-3/+3 hours) | Full-Time — Europe's leading business finance solution. You will help us simplify everything from everyday banking and financing, to bookkeeping and spend management.
Qonto

Senior Back End Developer - Ruby/Rails — Peggy useas AI to transform the art market. Come hack on an elegant Rails API with our world-class and fully remote team. ROR, PG, AWS, K8S, Sidekiq.
Peggy

Join the Remote Work Revolution — We offer the freedom of freelance with the security of full-time. Start working remotely with the world’s top clients today.
Toptal

📕 Articles & Tutorials

▶  Framework Friends: A Podcast Comparing Rails and Laravel — Laravel is a popular and (very loosely) Rails-esque framework in the PHP space which DHH even recently gave some kudos to. This new podcast features developers from each ecosystem telling their stories and making comparisons.

Framework Friends podcast

Talking of Laravel, its creator, Taylor Otwell, ▶️ went on the Remote Ruby podcast too and spoke about Laravel's origin story and how Rails has influenced it over the years.

Know What Your Scopes Are Doing: where.first vs find_by“Knowing the exact SQL Active Record is generating from methods that might seem the same on the surface can be very important.”

Andy Croll

Pipelining Without Pipes — A fun jaunt through a problem that benefits from mixing both OOP and functional bits of Ruby together showing how the language makes programmers happy.

Matheus Richard (thoughtbot)

Achieve Stripe-Quality Webhooks for Your App in Minutes 💃 — Hook Relay offers you inbound and outbound webhook management with automated retries, debugging, and delivery history.

Hook Relay sponsor

Finding an Initially Confusing Result in Rails — Do you really understand how find_or_initialize_by works?

Kevin Murphy

Don’t Run Your Ruby Minitest Classes Twice“If a Minitest class inherits from another class, it will also inherit its methods causing Minitest to run the parent’s tests twice.” (There’s a typo in the example, but the point remains.)

Ignacio Chiazzo

'The Problem That ViewComponent Solves for Me' — There’s been many articles on how to use the ViewComponent gem, but not many on why.

Jason Swett

▶  Discussing Audit Logging in Rails
Ruby Rogues podcast

🛠 Code & Tools

hotwire-example-template: A Collection of Hotwire Examples — Each branch is a different example including live preview, type-ahead search, dynamic forms, using maps, and more. With all the Hotwire tutorials coming out, this repository is timed perfectly.

thoughtbot, inc.

rrule: iCalendar RRULE Expansion for Ruby — RRULE is a specification for calendar/date ‘recurrence rules’ defined as part of the iCalendar spec. For example, you can have FREQ=DAILY;COUNT=3 resolve to dates over the next three days.

Square

🐘 The Developer Experience You’ve Always Wanted for Postgres

Crunchy Bridge sponsor

Alba 1.6: A Superfast JSON Serializer — Supports JRuby and TruffleRuby as well as CRuby. This release includes deprecations in preparation for a future 2.0 release, but also adds support for using instance methods as attributes.

Okura Masafumi

PGSync 0.7: Sync Postgres Data Between Databases — Speed and security are the order of the day, and you can sync partial tables or groups of tables. The README shows off some examples. Written in Ruby.

Andrew Kane

VCR 6.1: Record Your Test Suite's HTTP Interactions and Replay Them — A long standing library for recording HTTP interactions and replaying them during testing. Following 6.0 by two years, 6.1 is principally a release of tweaks and fixes rather than new features.

VCR

telegram-bot-ruby 0.18.0: A Ruby Wrapper for Telegram's Bot APITelegram is a popular messaging app (and even more so since Russia’s invasion of Ukraine) that’s particularly friendly to bots. This release adds support for more recent Bot API features.

Alexander Tipugin

Disco: Generate Recommendations Using Collaborative Filtering — The idea is simple: supply data that represents reviews or activities from users.. then you can generate recommendations for other users from it.

Andrew Kane

Torch.rb 0.10.0: Deep Learning for Ruby — A way to use Torch, an open source machine learning framework.

Andrew Kane

💡 Tip of the Week



bundle open

Sometimes, we'll see a gem throw an unexpected error, or behave in a way that we don't fully understand. In these cases, it can be useful to have more information. I often find it helpful to edit, or at least look at, the gem's code directly.

bundle open <gem_name> allows us to do this. All it requires to work correctly is that we set the EDITOR (or BUNDLER_EDITOR) environment variable to our preferred editor (for example, "EDITOR=code" or "EDITOR=vim"). Then if we run bundle open <gem_name>, it will open up our editor right to the directory of the installed gem itself. We can make any changes as we're debugging to help us figure out what is happening!

If you want to do something that's a one off and open the sinatra gem in VS Code, say, you could also do it in a single liner like so:

EDITOR=code bundle open sinatra

This week’s tip was written by Jemma Issroff and edited by Peter Cooper.