Short Ruby News - Edition #54

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

You can jump directly to a section:

šŸ‘ Our Community

[Sponsorā¬‡]

Find, hire, and manage world-class remote developers in US time zones, pre-vetted for technical and soft skills.Visit Revelo.com to find out more.

šŸ‘ Our Community

šŸ‘ Friendly.Rb announced that tickets are sold-out:

There are still a few spots available if you want to sponsor this conference:

šŸ‘ Avo announced the date for the open beta:

šŸ‘ Rubyconftw announced CFP are open for RubyConf Taiwan 2023

šŸ‘ Chris Oliver announced in a thread (read it on nitter) winners for RailsHackathon:

šŸ†• Projects

šŸ†• Modern Rails shared hottakes.tech 

https://hottakes.tech

šŸ‘‰ All about Code and Ruby

šŸ‘‰Plentiful Panda shared two recommendation for a Vim extension zbirenbaum/copilot.lua and zbirenbaum/copilot-cmp:

[Promo Contentā¬‡]

šŸ“£ Revelo.com has you covered: Whether you want to build a team from scratch, fill a skill or capability gap, or augment your team.

šŸ‘‰ Vidar Hokstad shared a screenshot of their editor build with Ruby using ruby-x11:

šŸ‘‰Stephann V. shared that destroy_all and delete_all can have different behaviors when they are called on a model or on a collection (see ActiveRecord::Associations::CollectionProxy)

šŸ‘‰Jason Garber shared lessons learned about headless Chrome and Docker:

šŸ‘‰ Paweł świątkowski asked about recommendations of gems with YARD docs:

Here are some recommedations:

šŸ‘‰ Brad Gessler shared their config to make Phlex.fun TailwindCSS autocomplete work in Sublime Text 4 (see the config gist here):

šŸ‘‰ Avi Flombaum shared about the frontend problem in Rails:

šŸ‘‰ Brad Gessler shared they migrated fly.io documentation to Sitepress.cc

[job ad from this edition partner Revelo.com]šŸš€ [Remote][Latin America] Get a full-time, long-term remote job and a dollar salary in amazing US tech companies.Apply at careers.revelo.com

šŸ‘‰ Jeremy Smith shared a thread about the Ruby Comparable mixin:

You should read the entire thread (read on nitter) where Jeremy describes the test, what failed, and how they found the cause.

šŸ‘‰ It's A&L shared a code sample showing a Rails route globbing example:

šŸ‘‰ Marco Roth shared how a memoization can speed up a lot Ruby code:

šŸ‘‰ Ruby Cademy shared a code sample about falsehoods Rubyists believe:

šŸ‘‰ Phil Smy shared a tip about optimising DB queries:

šŸ‘‰ John Nunemaker shared a tip about using feature flags:

šŸ‘‰ Robert Pankowecki shared a code sample about monkey patching a library and adding a detection for when to re-verify the patch:

šŸ‘‰ Avi Flombaum shared a code sample about:

šŸ‘‰ Matt Swanson shared about using code comments:

There is a good conversation about adding code comments in Ruby. Here are just a few of them:

šŸ‘‰ Avi Flombaum shared a Rails code sample about how to display breakpoint when on Tailwind:

šŸ‘‰ Kevin Newton shared a code sample that uses numbered params :)

šŸ‘‰ Takashi Kokubun shared a quiz (If you plan to think about this donā€™t click yet to open the quiz on Twitter or Nitter as you will see the result there):

šŸ‘‰ Radoslav Stankov shared a code sample showing how to use `class` as keyword param:

šŸ‘‰ Rob Zolkos shared a tip about making systems test instead of controller tests:

He also shared a Rails repo for anyone that wants to see how this works at GitHub - robzolkos/testperformance

šŸ‘‰ Marco Roth asked about naming a variable that holds a module object:

There are some interesting proposals there. I only picked a couple of them:

šŸ§° Gems, Libraries, Tools and Updates

šŸ§° Avi Flombaum announced they started to port hyperui to rails-components.com:

šŸ§° RubyGems announced the release of version 3.4.18 of RubyGems:

šŸ§° Piotr Murach announced the release of slideck - Present Markdown-powered slide decks in the terminal

šŸ§° Nate Hopkins announced the release of version 0.0.12 for TurboBoost Commands

šŸ§° Carter Bryden shared a code repo that shows how to implement custom domains for users in Rails: rails-custom-domains-example: An example repo for how to implement custom domains as a feature in a Ruby on Rails app

šŸ§° Andrea Fomera announced a new version 0.7.0 for RicherText.js

More library updates:

šŸ§° Hexa PDF - Versatile PDF creation and manipulation library - announced the release of version 0.33.0

šŸ§° Maciej Mensfeld announced a new release of karafka - version 2.1.9

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

šŸ¤ Related (but not Ruby-specific)

šŸ¤ Adrian Oprea shared tips for improving LCP:

šŸ¤ Jason Swett shared about planning for change:

šŸ¤ Chris Wanstrath shared about hiring based on Github activity graph:

More content: šŸ“š šŸ—ž šŸŽ§ šŸŽ„ āœšŸ¾

šŸ—ž Newsletters

šŸ—ž Harrison Broadbent published a new edition of RailsNotes Newsletter Issue 5

šŸ—ž Ruby Weekly published a new edition about Using Ruby in Jupyter Notebook

šŸ—žļø Allison Pike published a new edition of Once a Maintainer with Julik Tarkhanov

šŸŽ§ Podcasts

šŸŽ§ Rooftop Ruby Podcast published a new episode As Not Miserable as You Can Be with Dave Copeland ā†’ ā€œDave Copeland joins to discuss writing, background jobs, service objects, and moreā€

šŸŽ§ Rubber Duck Dev Show published a new episode about Evaluating Tech Tools with Kora Weaver ā†’ ā€œIn this episode of the Rubber Duck Dev Show, we discuss some ways you can evaluate your tech stack with Kota Weaver.ā€

šŸŽ§ Drew Bragg published a new episode of Code and the Coding Coders Who Code It about Episode 26 - Thomas Carr ā†’ ā€œThis episode I'm joined by Thomas Carr. Thomas is a Consultant & Software Developer for Emerging Technologies at CGI Federal. Which is a fancy way of saying he gets to play around with all the new tech out there and see what might have real world applicationā€

šŸŽ§ The Rails Changelog published a new podcast about 010: Improved Active Storage docs, a new has_secure_token callback with Dave Kimura ā†’ ā€œDave Kimura of Drifting Ruby fame joins me to discuss the importance of Ruby on Rails documents. We talk specifically about improved documentation around Active Storage and Active Record encryption, then dive into the new callback for when has_secure_token is triggeredā€

šŸŽ§ Ruby Rogues published a new episode about Can you do AI /Machine Learning in Ruby? ā†’ ā€œLandon Gray is a Compassionate Consultant, an AI/ML Enthusiast, and a conference speaker. He joins the show to further talk about his conference topic, "AI in Ruby". He begins by explaining how he landed with the idea of using AI or ML in the native Ruby. Additionally, they dive into other Ruby projects that used AI or MLā€

šŸŽ§ The Ruby on Rails Podcast published a new episode about Episode 481: Advice on Sunsetting a Rails Application with Robby Russell ā†’ ā€œRobby Russell, CEO of Planet Argon, joins the show to guide Brittany on the steps to take to decommission a Ruby on Rails application. The pair also touch on the idea of how small dev teams would benefit from periodically bringing in "guests" to their codebaseā€

šŸ“½ļø šŸŽ„ Videos

Screencasts

šŸŽ„ Jason Swett published a new video about Building a GPT plugin for Vim (with tests)

šŸŽ„ Dean De Hart published new videos about:

šŸŽ„ Drifting Ruby published a new video about Episode 412 - Intervals and Timeouts | Drifting Ruby

šŸŽ„ Tim Morgan published a new video about COMPILER FUN, DAY 12: LLVM JIT

āœšŸ¾ Articles

Whatā€™s new

Harrison Broadbent published an article about Skipping the console with Rails Runner ā†’ ā€œif you're getting RSI from typing rails console all day, I've got something to show you ā€” rails runner. The rails runner command is a handy Rails command which lets us run commands inside our Rails console, directly from our terminalā€

Avi Flombaum published a series of articles about rails-component.com They are a great exploration of what Avi is trying to solve: Rails-Components.com: What is it?,  Why Ruby on Rails Needs Components, Rails Components: More Installer Over Library.

James Adam published an article about Turbo Stream and personalised content ā†’ ā€œEver wanted to render different content for the current user vs other users in partials being handled by Turbo? I frequently do, but I was surprised to find basically nothing online about how to do it, nothing in the official documentation and no blog posts describing it. Hereā€™s one approach that works pretty well.ā€

Jorge Manrubia published a new article about Globals, callbacks and other sacrileges ā†’ ā€œMaximalist positions are a thing in our industry. Take a technique, outline its drawbacks, extrapolate you canā€™t use it under any circumstance, and ban it forever. We are lucky that Rails embraces exactly the opposite mindset as one of its pillarsā€

Jenny Shen published an article about Level up your RubyGems Account Security with Security Devices ā†’ ā€œWe are excited to announce that WebAuthn is fully integrated and is recognized to be the preferred choice for multi-factor authentication (MFA). When users register a security device, they will now be provided with recovery codes and be able to configure their multi-factor authentication level without needing to enable time-based one time password (OTP) MFAā€

Arjit Jaiswal published an article about I like my code DAMP ā†’ ā€œThe problem of over-abstraction is well-documented. But thereā€™s another problem tooā€” it enforces our human intuition that redundancy == verbosity == waste. And unfortunately, it leaks into both our subconscious and our linters. So, I propose a new way of thinking: DAMPā€

Alkesh Ghorpade published an article about Rails 7.1 enhances PostgreSQL enum functionality ā†’ ā€œRails 7.1 adds enum rename, add value and rename value methods to extend its support for PostgreSQL enum typesā€

I published an article about Projects ideas for learning Ruby or any Ruby web framework ā†’ ā€œProjects to tackle as you learn a new programming languageā€

Amanda Perino published an article about Introducing the team behind the Rails World website ā†’ ā€œWe would like to introduce you to the team that brought the Rails World website to life. Back in April we put out a call for junior developers to create the Rails World website under the mentorship of a senior developerā€

Lucas Barret published a new article about Playing with Redis and Rails ā†’ ā€œI will share my thoughts and idea, playing along with Redis and Ruby, Like I said less structured and maybe comments or deep dive, but I had a lot of fun writing and playing with thisā€

Deep Dives

Kevin Newton published a new article about ActiveRecord::UnionRelation ā†’ ā€œI wrote a gem back in 2020 called active_record-union_relation, and Iā€™m finally writing a blog post describing it. This is a very small gem that provides the ability to define Active Record relations from UNION queriesā€

Akshay Khot published an article about Content Security Policy (CSP): What Every Web Developer Must Know ā†’ ā€œThis is a comprehensive guide to Content Security Policy (CSP). If you build websites for a living, CSP is an important concept to know, understand, and implement to protect your users from Cross-Site Scripting (XSS) Injection attacks. This post covers (almost) everything you need to know about CSPā€

Aestimo Kirina published an article about Advanced Usages of Devise for Rails ā†’ ā€œIn this part, we'll explore more advanced usages of Devise, specifically the use of OmniAuth, API authentication, and Authtrailā€

Jared Norman published a new article about Service Objects ā†’ ā€œI've compiled everything you need to know about when to use service objects and documented all the common variations of the pattern so that you can choose the right conventions for your projectā€. He followed up with What if service objects were just Procs?

How-Tos

Harrison Broadbent published an article about Split your database seeds.rb by Rails environment ā†’ ā€œThe seeds.rb file makes it easy to pre-populate your database with data for development or production. Unfortunately though, since each Ruby on Rails app only has a single seeds.rb file, it can quickly get cluttered. Plus, there's bound to be data you want to seed in production, but not development (or vice-versa)ā€

Nithin Bekal published an article about Ruby and Jupyter Notebooks ā†’ ā€œDoes Ruby have something similar to Jupyter notebooks? Turns out that you can just use Jupyter notebooks with Ruby if you setup the iruby kernelā€

Matt Brictson published an article about Automate Rails deployments with GitHub Actions ā†’ ā€œI deploy all my Rails apps using Tomo, a Ruby command-line tool I developed. Like MRSK, Capistrano, Mina and other similar gems, Tomo orchestrates deployments by executing scripts over SSHā€

Alkesh Ghorpade published an article about Normalize Data with Rails 7.1 ā†’ ā€œRails 7.1 adds normalizes method to ActiveRecord::Base, which can be used to declare normalization for attribute values. The method can be used to sanitize user inputs, enforce consistent formatting and clean up data from external sourcesā€

BiggerPockets published a new article about Finding unused Rails view partials with DataDog and Github Actions ā†’ ā€œAs a Rails application matures, views gets moved around and sometimes rewritten. This opens up the possibility of dead view partials lying around: partials that are no longer rendered by any views. These unused view partials clutter up our workspace and impose a small maintenance burden. At BiggerPockets, we use DataDog and Github Actions to identify these unused partials so that they can be manually cleaned upā€

Brooke Kuhlmann published a new article about Ruby Object Inspection ā†’ This article will take a closer look at Ruby object inspection

Mike Coutermarsh published an article about How to make a Fly API call from Ruby ā†’ ā€œFly has a graphql API available. You can find ways to use it by looking through their CLI's source code. I recently wanted to automate a Fly API call from a ruby script. And I was not in an environment where I wanted to install the fly CLIā€

Povilas Jurčys published an article about Many ways to write RSpec custom matchers ā†’ ā€œWhen it comes to creating custom matchers in RSpec, developers have two powerful approaches at their disposal. Each method offers distinct advantages, giving you the flexibility to tailor your matchers to your specific testing needs. In this article, we will delve into both of these approaches to equip you with the knowledge to write expressive and adaptable testsā€

Mika Henriksson published a new article about Client side rate limiter ā†’ ā€œLong-running jobs are bad, like terrible, and should be avoided at almost all costs. Splitting the work into multiple background jobs using batches is a great idea. Now as the work ran in parallel, it finished fast! Unfortunately, it bombarded the external API with too many concurrent requests, and their API returned many rate limit errorsā€

Max Normand published a new article about The Builder Design Pattern in Ruby ā†’ ā€œThe builder pattern, is part of the Ā«creational design patternsĀ». In summary it simplifies the processes of creating complex objects. We create a builder class that should have everything we need to help ease the complexities around creating our objectsā€

Kaka Ruto published a new article about Uploading Files to CloudFlare R2 Using Rails ActiveStorage ā†’ ā€œR2 is a new object storage system by Cloudflare. It is comparable and compatible with Amazon S3, except much simpler and cheaper, and with a very generous free plan. You can read more about it here. Let us see how to set it up with Rails so we can upload files for this articleā€

Julian Rubisch published a new article about Understanding Rails Apps Through Powerful Visualizations ā†’ ā€œWhen it comes to reviewing a Rails app, two essential factors stand out: discoverability and good visualization of the code structure. Being able to comprehend the core elements and potential threats of a Rails app is crucial for developers and stakeholders alikeā€

William Kennedy published a new article about Tidy Up Your Views with Request Variants ā†’ ā€œWhen I gave my recent Turbo Native talk for Ruby Ireland, one of the questions that came up repeatedly was about duplicating views for both native and Rails. I got many questions asking if I have ā€œif-elseā€ logic in my views to accommodate mobileā€

Brandon Keepers published an article about Switch ActiveJob backends without disruption ā†’ ā€œEarlier this year, we helped a customer migrate their Rails application to a new ActiveJob backend. As with most applications, their background jobs performed critical workloads, like emailing users, communicating with external services, and keeping things tidy. Even a momentary blip in background job processing can quickly become a user-facing issueā€

Related

Birgitta Bƶckeler published a new article about Exploring Generative AI ā†’ ā€œGenerative AI and particularly LLMs (Large Language Models) have exploded into the public consciousness. Like many software developers I am intrigued by the possibilities, but unsure what exactly it will mean for our profession in the long run. I'll be posting various memos here to describe what my colleagues and I are learning and thinkingā€

Please consider becoming a paid subscriber to support this newsletter for just $1.5/week ($6.5/month) and you will receive an ad-free version. 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.