#​591 — February 17, 2022

Read on the Web

Ruby Weekly

Introducing Propshaft: The Future of Asset Pipelining in Rails? — Propshaft is a new asset pipeline for Rails that boasts an approach that takes advantage of modern web technology, is “dramatically simpler than the Sprockets that went before it”, and is the heir apparent to handling assets in Rails 8 (but no sooner, says DHH).

David Heinemeier Hansson

Take the 2022 Ruby on Rails Survey — This is the seventh outing for Planet Argon’s survey which began way back in 2009. We support it each time as the results always make for interesting reading (see 2020’s results for example). Participate and make your Ruby and Rails preferences known.

Planet Argon Team

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: Ruby-Weekly!

Cloud 66 sponsor

Ruby 3.1's Error Highlighting Gemerror_highlight is a gem loaded by default in Ruby 3.1+ that makes it clearer which piece of code causes an exception. You can customize the results too, as demonstrated in this post.

Alkesh Ghorpade



Director of Engineering @ ButterCMS (Remote) — Working closely with our founder and CEO, you’ll own all technology, deliver on our roadmap, and most importantly, ensure that our customers are successful.

Help Us Build and Shape a Tool That Thousands of Developers Use Every Day — We are a differently shaped company that values work-life balance and supports staff to work the ways that make sense for them.

Find Ruby Jobs Through Hired — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers.

📕 Articles & Tutorials

Delayed Job vs. Sidekiq: Which Is Better? — Two quite different approaches to a similar task: running background jobs. Delayed Job is simple and can use your existing database to store its required data. Sidekiq uses Redis but is particularly fast and scalable.

Sapan Diwakar

Writing Ruby Gem Native Extensions in Rust — Consider this a potential sneak preview as some Ruby core members are using Rust to work on YJIT and there is a current PR to add the ability to write Rusty Ruby extensions.

Brian Kung

Application Performance Monitoring, Built for Developers by Developers

Scout APM sponsor

▶  Rails Authentication with Rodauth — If you haven’t looked at Rodauth yet, it’s a robust authentication platform that offers a load of features (normal and passwordless login, easy customization) that might just win you over from Devise.

Janko Marohnić

▶  Discussing How to Migrate to Rails 7 — Four Rubyists come together to discuss the techniques and tools needed to migrate apps to Rails 7, as well as their favorite Rails 7 features. (1 hour 8 minutes.)

Ruby Rogues Podcast podcast

What I Learned From My First Rails Upgrade — Initial experiences from someone working in a team specializing in upgrading Rails apps.

Gelsey Torres

When I Do TDD and When I Don't
Jason Swett

🛠 Code & Tools

UniMIDI: Realtime MIDI I/O for Ruby — Supports macOS, Windows, and Linux and lets you work with MIDI input and output at a low level directly from Ruby. It’s been around for over a decade but now supports Ruby 3.

Ari Russo

jmespath.rb: A Ruby Implementation of JMESPathJMESPath is a query language for JSON, though can work with regular Ruby objects too.

Rowe, Theo, et al.

Config 4.0: Add Multi-Environment Settings to Rails, Sinatra, and Other Ruby Projects — Using simple YAML config files, this provides a mechanism for adding a settings/configuration features to Ruby apps of all types.

Ruby Config

Project Management for Software Teams Has Never Been Easier — Shortcut is fast and intuitive project management built for developers. Delight the scrum gods and try it now.

Shortcut (formerly Clubhouse.io) sponsor

Gemsmith v17: A CLI Tool for Smithing New Ruby Gems — If you want to go a step beyond Bundler’s gem skeleton.

Brooke Kuhlmann

GitHubOrgManager: A Manager for GitHub Organizations — If your company uses a GitHub organization and you need to stay up to date with every repo in that org, this could help.

Brandon Weaver

Ruby Trello API: An Implementation of the Trello API for Ruby — For users of the popular Trello list-management webapp.

Jeremy Tregunna

Pundit 2.2 Released: The Pure Ruby Authorization Library

Rambulance 2.2: Dynamically Render Error Pages or JSON Responses for Rails Apps
Yuki Nishijima

Elasticsearch Gem 8.0: Ruby Integrations for Elasticsearch

💡 Tip of the Week

Adding bin dir to $PATH

In last week's tip, we discussed using binstubs. Instead of running bundle exec <some executable>, we can run a binstub directly from the bin directory. For instance bin/rubocop.

Typing bin/rubocop can still feel cumbersome or leave us prone to forgetting the bin and making a mistake. It could be easier if we just had to run rubocop for instance, and our shell knew to run bin/rubocop.

Operating systems use a $PATH environment variable to tell them where to look for executable files. (From a shell, try echo $PATH to see what's currently in this environment variable.) In order to get our shell to infer executables in our bin directory, we can add the bin directory to our $PATH variable.

One nuance here is that we'll want our shell to recognize the bin directory of whatever repository we're currently in, even though we might have multiple bin directories in different repositories. We can do this by appending ./bin to our $PATH variable. . means current directory, so ./bin means the bin directory in our current repository.

We can add this to our $PATH variable with export PATH="./bin:$PATH". Breaking this down: it says to set $PATH to ./bin:<whatever was already in PATH>. (Note: you might have to change this slightly for different shells.)

However, if we do this in a shell and then exit that shell, it won't persist. To ensure it persists, we want to copy this line over to a file which runs every time we open a new shell. Depending on what shell you're using, this might be ~/.bash_profile, ~/.bashrc, ~/.zshrc, or so on. Adding this line (or equivalent) means that the bin directory within any repository we're in will be on our $PATH. From now on, we can simply run rails s, for example, instead of bundle exec rails s or bin/rails s.

This week’s tip was written by Jemma Issroff.