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:

šŸ‘ Our Community

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:"

šŸ‘‰ 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ā€)

šŸ§° Steve Jackson and Daniel Huss published a new gem gem_dating - GemDating is a library for determining the relative age of a set of gems

šŸ§° Xavier Noria announced the release of version 2.6.9 of Zeitwerk Read the changelog

šŸ§° Koichi Ito shared GitHub - rubocop/vscode-rubocop: The official VS Code extension for the RuboCop linter and code formatter that enables real-time, high-speed `rubocop -x` in VScode:

šŸ§° 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

šŸ“½ļøAny Cable published a new video about AnyCable v1.4: reliable real-time for all: Ruby, Rails, Hotwire and beyond

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 S3 ā†’ about 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.