🤗 Short Ruby News - Edition #53

Discover the world of Ruby in this comprehensive newsletter covering week 29 of 2023. Find code samples, community updates, gems, resources, and thought-provoking discussions.

You can jump directly to a section:

More content: 🗞 🎧 🎥 ✍🏾 (articles, podcasts, videos, newsletters)

[Sponsor⬇]

Harrison here from The RailsNotes Newsletter — each week, I send out a 5 min read covering a few great Ruby on Rails articles from my blog and around the web. If you like ShortRuby, you'll probably like The RailsNotes Newsletter, too, so come check it out!

Subscribe and read the latest issue here — https://railsnotes.xyz/newsletter

👐 Our Community

👐 Kasper Timm Hansen announced a new project called Open Source Retreat — Summer 2023

👐 RailsWorld published the final list of speakers Meet the Rails World Speakers:

👐 Avi Flombaum started to re-start the NYC on Rails | Meetup again:

👐 Ruby City Matsue announced Ruby Prize 2023 is now accepting recommendations:

👐 Chris Oliver announced the beginning of Rails Hackathon Begins which happened in the last weekend.

The hackathon ended but you can see the projects at railshackathon.com and vote the ones that you like.

👐 The Rubber Duck Dev Show shared their schedule for the next month:

👉 All about Code and Ruby

👉 /u/eggbrain asked about the current state of Rails WYSIWYG / Rich Text Editor integrations:

The recommended answers are:

👉 Okura Masafumi shared how they think about tests and using tests as documentation:

👉 Xavier Noria shared a thread about :: in Ruby:

And Yukihiro Matz replied:

Kevin Newton added:

Nick Schwaderer shared gist showing other ways to use ::

and Xavier added more:

👉 I asked about recommendations of open-source repos:

You can read the replies on ruby.social and on twitter (alternative on nitter)

Here are some of the recommendations:

👉 Marco Roth shared a code sample showing how to use the Stimulus Elements API (read the full blog post)

👉 Olivier Lacan asked about recommendations of Ruby powered companies working on climate solutions:

👉 Rob Zolkos asked a question on social media and on the Ruby on Rails forum Do Basecamp/Hey use ViewComponents?

👉 Olivier Lacan shared a screenshot of bundle up gem:

👉 Nate Hopkins announced a revamped of the TurboBoost Commands website:

👉 Jonathan Markwell shared what projects helped them the most for building SaaS:"

🤗 If you like the newsletter and can afford you should consider upgrading to paid. It is 6.5$ per month. You will get a free from ads and upgrade invitations (like this one) version while supporting this project to continue to be free and sustainable.

👉 Janko Marohnić shared a thread about generating passkeys with Rodauth:

👉 The Rails Changelog shared a Rails tip to append to a collection of attached files:

👉 Greg Navis shared about the Ruby safe navigation operator is a code smell:

Among other replies, Rostislav Zhuravsky shared another perspective about this:

👉 Marc Köhlbrugge shared how they use SQL queries to do funnel analysis:

👉 Martin Spickermann shared a piece of code showing how to use ActiveRecord#find

👉 Greg Navis shared a thread about database constraints in Rails. Read the full thread @gregnavis or read it on nitter:

👉 John Nunemaker shared how to use bundler to update git source:

👉 Chuck Smith shared about the biggest challenge as a contractor when upgrading Rails:

Adrian Oprea replied with:

👉 Adam shared about memoizing a class instance variable and thread safety:

👉 Harrison Broadbent shared a tip to make a turbo frame tag scroll into view:

🧰 Gems, Libraries, Tools and Updates

🧰 Lewis Buckley announced a new gem basecamp/rspamd-ruby: Ruby client for Rspamd’s HTTP API. Rspamd is a “Fast, free and open-source spam filtering system”

🧰 JetBrains announced the release of RubyMine 2023.2 with AI Assistant included. Read the full list of improvements in the What’s new announcement

🧰 Dima Fatko published a new version of online_migrations (“Catch unsafe PostgreSQL migrations in development and run them easier in production”)

🧰 Xavier Noria announced the release of version 2.6.9 of Zeitwerk Read the changelog

🧰 Avi Flombaum announced the release of version 0.5.0 of shadcn-rails. Checkout latest commits

🧰 Janko Marohnić shared that support for passkeys is released to roaduth Add internal request support for WebAuthn by janko · Pull Request #355

🧰 Thomas Countz announced version 0.2.0 of their genetic algorithm gem petri_dish_lab - A Ruby library for Evolutionary Algorithms

🧰 Joshua Young proposed a new feature to be added to Ruby language Enumerable#uniq_map

Thank you for reading Short Ruby Newsletter. This post is public, so feel free to share it.

🤝 Related (but not Ruby-specific)

🤝 Andrew Morris shared what Kafka is exchanging as commands for the health check:

🤝 Adrian Oprea shared an insight about simple code:

🤝 More content: 📚 🗞 🎧 🎥 ✍🏾

🗞 Newsletters

🗞 Harrison Broadbent published a new edition of RailsNotes Newsletter Issue 4

🗞 Ruby Weekly published a new edition about Machine learning in Ruby

🗞 Ruby Radar published a new edition about Mind Expansion

🗞 Matheus Richard published a new edition of This week in #dev

🗞 This Week in Rails published a new edition This Week in Rails - July 28, 2023

🗞 Ruby LibHunt published a new edition of the Awesome Ruby Newsletter

🗞 Ruby Central published a new edition of their monthly updates June 2023 Monthly Update

🗞 The Bike Shed published a new episode about Submitting a Conference Talk Proposal from Start to Finish

🎧 Podcasts

🎧 Rubber Duck Dev Show published a new episode about Scarpe Diem With Nick Schwaderer → “In this episode of the Rubber Duck Dev Show, we discuss Scarpe, which is a successor to the Shoes Ruby desktop application builder with Nick Schwaderer”

🎧 Remote Ruby published a new episode about The One Where We Talk About Our STIs “Jason, Chris, and Andrew dive deep into their personal adventures and tech talks, including a detailed discussion on Single Table Inheritance (STI) in Ruby on Rails, sharing different perspectives, use-cases, and alternatives.”

🎧 Indie Rails published a new podcast about IndieRails | Khash Sajadi - The Journey to the Cloud(66) “Join us as we listen in to Khash as he shares his story of startup failures & successes, consulting and employment in between and navigating political, economic and geographical constraint”

🎧 The Ruby on Rails Podcast published a new episode about Gnarly Rails with Nick Maloney “Nick and Brittany discuss Gnar's project for the State of Massachusetts to build out an automated background check system. Nick shares why Rails is their default stack and why he is particularly impressed with the direction of the front-end happening in Rails 7.”

🎧 Jason Swett published a new podcast about 191 - Payload CMS (YC S22) with Dan Ribbens - The Code with Jason Podcast “This week, I'm joined by Dan Ribbens for an in-depth conversation about his headless CMS software Payload CMS. We also discuss other CMS platforms and Dan's experience with Y Combinator”

🎧 Slow & Steady published a new podcast about Database constraints with Andrew Atkinson | Slow & Steady “Benedikt talks to Andrew Atkinson about different types of database constraints and his upcoming book”

📽️ 🎥 Videos

Screencasts

🎥 Dean De Hart published new videos about:

🎥 Ruby Cademy published a new video about IntuitiveClassName + EncapsulatedMethods = Joy!

✍🏾 Articles

What’s new

Breno Gazzola published a great guide about Active Storage in production: lessons learned and in-depth look at how it works “While we love Active Storage (which I’ll call AST from now on), there are certain design decisions in AST that one should be aware of, as they have an impact on the overall performance of the app, and not just the pages that use AST”

Nikola Đuza published a new article about Using Server-Sent Events (SSE) to Stream Data in Rails → “Usually, a page sends a request to the server to receive new data. That is how most of us develop the web nowadays. What if I told you there is another way to get the data to the page? With server-sent events, a server can send new data to a web page at any time by pushing messages to the web page.”

Marco Roth published a new article about Supercharge your Stimulus controllers with Custom APIs “we will explore the process of creating a new Stimulus API that can be used in any Stimulus Controller.”

Avi Flombaum published a new article about Building shadcn Form Builders in Rails“For shadcn on rails, I wanted to create a custom form builder that would plug my shadcn form inputs and controls into ActiveModel so that the error validations and other features native to Rails forms would work”

Kevin Luo published a new article about Dear AI, can you translate the Rails Guide for me? “I used ChatGPT API to translate the Rails Guide into different languages”

Alkesh Ghorpade published a new article about Rails 7.1 adds the --parent option to the controllers“Rails 7.1 adds the --parent options to controller generator that helps the developer pass the parent controller name. You must pass --parent=CONTROLLER_NAME to the rails generate controller command” and another one exploring Rails 7.1 adds picture_tag helper to support HTML5 picture element.

Steve Polito published an article, about Are you absolutely sure your Rails caching strategy isn't leaking sensitive information? ”Rails writes a new cache entry based on the first request. But what happens when that request is from an admin?”

Rafael Peña Azar published a new article about Exploring Genetic Algorithms with Ruby “we'll dive into the intriguing realm of genetic algorithms in Ruby and explore real-life applications that showcase their potential. These algorithms mimic the principles of Darwinian evolution, and when combined with the expressive and elegant Ruby language, they become a powerful toolset for tackling a wide range of challenges”

Lucas Barret published a new article about Services Object with GraphQL And Rails where Lucas explains how a service layer in Rails and GraphQL can manage code complexity, improve readability, and enable better testing..

Avi Flombaum published a new article about Generating Audio Waveform Images in Ruby → “In this post we'll walk through some Ruby code that generates a waveform image from an audio file”

Gavin Morrice published a new article about Avoiding train-wrecks in ActiveRecord “one doesn’t have to look far in a Ruby on Rails codebase to see chains of ActiveRecord scope methods being called on a model or ActiveRecord::Relation object like this. This chain of methods all smooshed together like a crashed train with many carriages is what some people affectionately call a «train-wreck»”

Deep Dives

Cody Norman published a new article about Using Concerns With Ruby On Rails“I thought this was a great opportunity to refresh myself on some of the details around Concerns in Rails, why they’re useful and how to implement them.”

Olly Chadwick published two articles about Loading files in Ruby and Loading files in Rails → “ First, we’re going to talk about how Ruby finds other files. Then, once we’ve got our head around that, we’re going to look at the extra sprinkles of magic that Rails adds on top.”

Daniel Lempesis published an article about An Introduction to Metaprogramming in Ruby “In this post, we'll take a look at metaprogramming methods like send, define_method, and method_missing and show how they can solve problems we sometimes run into, even in normal Rails applications” [If you want you can check the comments about this on HN]

Andrew Stewart published an article about Introduction to Discard“Today, we’re going to explore the history behind the discard gem, and how it can be used to add soft-deletion functionality to Rails/ActiveRecord models”

Vlad Hilko published a new article about Understanding Transaction Isolation Levels in Rails with Simple Examples “we will discuss the usage of database transactions in a Rails application, with a particular focus on one of the ACID principles - Isolation - and its four levels. We will explore what these isolation levels are, why they are necessary, and the problems they aim to solve”

How-Tos

Carla Urrea Stabile published a new article about What is Role-Based Access Control (RBAC) and How to Implement it in a Rails API? → “There are different ways to implement an authorization system and the one you chose depends on your application's needs. Role-Based Access Control (RBAC) is just one of them, so let's go ahead and learn how to implement it in a Rails API”

Janko Marohnić published an article about implementing Passkey Authentication with Rodauth “I would like to show how to set each of these up in a Rails app that uses rodauth-rails. I’ll be using Safari on macOS Ventura and have iCloud Keychain sync enabled, which is a requirement for Apple passkeys”

Mike Coutermarsh published a new article about Setting an Actions secret with Octokit.rb - Ruby Example → “Here's a Ruby example of how to set a GitHub Actions secret using Octokit in Ruby”

Gowsik Vivekanandan published a new article about Integrate Replicate in Rails Application “With Replicate, we can run machine learning models in the cloud without the need to set up our infrastructure or have in-depth knowledge about machine learning. Replicate allows us to run both public and private models”

Harrison Broadbent published two articles Simple Lazy Loading in Rails with Hotwire and Turbo Frames “Hotwire and Turbo Frames make it easy to add lazy-loading into our Rails apps — I'm talking only 12 lines of code” and Overmind 🪬, a better bin/dev for your Procfile → “I wish I had learned about Overmind sooner! Foreman and bin/dev were fine, but now that I've discovered Overmind, I don't see myself ever going back”

Akshay Khot published a new article about How to Dynamically Create Instance Variables in Ruby → “This post shows one way to dynamically initialize multiple instance variables in a Ruby class using metaprogramming. If you need to pass multiple, separate pieces of data to a constructor (and cannot refactor the code for some reason), it's a pretty good technique to reduce all the repetitive code.”

Matt Brictson published an article about How to organize CSS in a Rails project “New Rails projects start with a single CSS file: application.css. Inevitably every non-trivial app is going to have more CSS than will fit comfortably in that one file. While you may be tempted to declare a comprehensive file and folder structure up front, I suggest starting small and taking the incremental approach.”

Phil Smy published a new article about Revolutionize Your Rails App with DynamoDB: Unleash Speed and Scalability! “When developing a new service, we realized that a core model would be well-suited for storage in DynamoDB, Amazon’s fast and scalable NoSQL solution” and another one about A Seamless Migration from Database to AWS S3about migrating email messages stores in a DB to S3 storage system.

Fiona Lapham and Ariel Juodziukynas published an article about Navigating Asset Management Madness; Rails 3.0 -> Rails 7 and Beyond → “There have been a lot of changes over the years in asset management opens a new window for Ruby on Rails applications. The main question, after all the madness, is… “What should I do if I need to upgrade my Rails application?”

Avi Flombaum published a new article about Prettier for ERB where Avi shares a configuration to make prettier work with *.erb files

Thomas Hareau published an article about How to release a new gem version in thirty seconds“I recently experimented process automation through GitHub action. Though there is one drawback in term of security, new gem versions can be released in two clicks”

Related

Ryan Bigg published a short article describing how to fix How to fix: Chromedriver 115, cannot find chrome binary on MacOS → “Chromedriver v115 was released recently and causes this issue to appear on Macs that use Chromedriver for automated testing”

Please consider becoming a paid subscriber to support this newsletter for just $1.5/week ($6.5/month). Your contribution aids growth and maintains the quality of ShortRuby for everybody:

If you consider upgrading and want more information, please read Why to subscribe to paid.

Reply

or to participate.