👉Short Ruby News - Edition #55

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

You can jump directly to a section:

📅 Events

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

Looking for sponsors 🤞

Friendly RB is a friendly Ruby conference, happening on 27-28 September in Bucharest, Romania. Tickets are already sold out! We are just looking for few more sponsors. 

There are 6 spots available for Community Sponsorship at only $1250."We are looking for sponsors to partner with us in bringing a new and unique European conference. Sponsorship funds will go toward keeping ticket costs low, honorariums for conference speakers, and video recording"If you think your company might want to sponsor this conference please write to [email protected].

👐 Our Community

This is about:

Do you know someone who has consistently gone above and beyond to help others, who has shaped discussions, answered countless questions, triaged bugs, added particularly helpful features, or introduced us all to innovative new ideas?

Nominate these exceptional individuals who you believe deserve to be recognized using the form below.

👐 Ian shared #helloworld_rb

📅 Events

👐 Lucas Barret announced they plan to launch a new podcast:

👐 Juliana Dias announced that Tropical Ruby 2024 is back

👐 Avi Flombaum shared they are looking for a space for NYC on Rails | Meetup

👐 Euruko shared Euruko 2023 agenda:

👐 Ruby Conf announced their first speaker RubyConf Homepage

👉 All about Code and Ruby

Please consider upgrading to paid to support this newsletter and get an ad-free version.Or if you have a product or service, book or event (even better if they are built with Ruby) that you want to promote in this newsletter consider choosing one of the sponsorship packages. 

👉 Yukihiro Matz shared about methods in Ruby:

👉 I shared a thread with some insights from Stack Overflow survey:

👉 Postmodern asked about error key for validating belongs_to:

And it seems that the response could be:

👉Nithin Bekal shared their article Ruby's bang methods - Handle with care! with a code sample:

👉 Takashi Kokubun shared about Ruby 3.3 YJIT improvements:

Takashi also shared a merged PR YJIT: Compile exception handlers:

Please consider becoming a paid subscriber to support this newsletter and you will receive an ad-free version. Your contribution aids growth and maintains the quality of ShortRuby for everybody:

👉 Donn Felker asked for recommendations of Sidekick config:

Victor Shepelev replied with another code sample:

👉 Thomas Countz shared a thread about closures in Ruby:

And he also shared how they used this in a gem:

👉 @[email protected] asked about how to start TDD:

Here are some of the replies:

👉 Prabin Poudel asked about using JSON type column in PSQL:

Here are some of the replies:

👉 Ruby Cademy shared how to configure Rails COnsole Prompt to show environment:

Here is a similar tip shared a while back by Matt:

👉 Rob Zolkos shared how to define a relation between users and teams:

Stephen Margheim proposed an improvement:

👉 Samuel Williams shared about the performance of sus test runner:

👉 Ruby Cademy shared about using Faker random to get the same results:

👉 Harrison Broadbent shared a tip about using y to print data in YAML format in Rails:

👉 Kevin Newton shared a tip about using Integer#anybits?

👉 Gavin Morrice asked about why create setters and getters instead of using ivars:

There is a good discussion there (read on nitter) about coding styles.

👉 Kevin Newton shared about redefining Integer#-@

👉 Kevin Newton shared about magic comments:

👉 Greg Navis shared a thread about Active Jobs callbacks:

👉 Janko Marohnić asked about the approach to store session in DB and store session ID in cookie:

The replies are mostly pointing out either the limitation of 4KB or the security feature to be able to logout from all sessions:

🧰 Gems, Libraries, Tools and Updates

🧰 Rafael Franca announced the release of Rails 7.0.7. Read the full changelog here

🧰 Sinatra announced a new release of version 3.1 that has new features:

🧰 Avo announced that Avo 3 beta is now open → Avo 3 Beta

🧰 Jeffrey Phillips Freeman announced their new gem called abstractify → a gem to create abstract classes in Ruby:

🧰 Avi Flombaum shared a repo that has configuration for A simple TailwindCSS powered Github Pages Starter

🧰 Marco Roth announced the release of a new version for Stimulus → Release v3.2.2 · hotwired/stimulus

🧰 Kevin Newton announced the first version of yarp gem

🧰 Yasuo Honda announced a release of a new version activerecord-oracle_enhanced

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

🤝 Related (but not Ruby-specific)

🤝 Julian Rubisch shared a thread (read on nitter) with the result of a survey they did about Tech Debt. I added here only one of the data shared:

🤝 Justin Jackson shared how to block GPT bot to access your website OpenAI Platform

🤝 Gergely Orosz asked about how to think about moving to the manager path:

🤝 Adrian Oprea shared an advice about naming:

🤝 Julian Rubisch shared what does it mean to be a senior:

🤝 Maple Ong shared a tip about accessing the PR diff on Github:

👉 Naofumi Kagami 加々美直史 shared about TDD:

More content: 📚 🗞 🎧 🎥 ✍🏾

📚 Jason Charnes shared an update about Active Record Cookbook:

📚 Jason Swett asked for community help to meet people working at AI tech products:

📚 Joe Masilotti shared an update about their Turbo Native book:

🗞 Newsletters

🗞 Ruby Weekly published a new edition #666 - Sinatra 3.1 released

🗞 Allison Pike published a new edition of Once a Maintainer about Brendon Muir “Building tools for primary schools in New Zealand using Rails”

🗞 Greg Molnar published a new edition of This Week in Rails: A new release, Action Mailer preview empty states, bugfixes and more!

🗞 Any Cable published a new edition about Any Cables Monthly #12

🎧 Podcasts

🎧 Remote Ruby published a new episode about Hackathon - Strada - Rails World

🎧 The Ruby on Rails Podcast published a new episode about Episode 482: Everything is Awe(ful)some! (Brittany + Brian)

🎧 The Bike Shed published a new episode about 396: Build vs. Buy

🎧 Rooftop Ruby published a new episode about 22: Abstraction Goes All the Way Down

🎧 Indie Rails published a new podcast about IndieRails | Nadia Odunayo - Building The StoryGraph

🎧 Maintainable Software Podcast published a new podcast about Ahmed Wasfy - Thriving as an Engineering Manager

📽️ 🎥 Videos

📽️ Avi Flombaum streamed during the weekend a series of videos about courseguide.ai - here is the planning session and here is the coding session

Screencasts

🎥 Yaroslav Shmarov published new videos about:

🎥 Dean De Hart published new videos about:

🎥 Nick Sutterer published a new video about How to nest operations in Trailblazer

🎥 Phil Smy published a new video about How To Integrate Chatgpt With Rails 7: Step-by-step Tutorial

🎥 David Kimura published a new episode about PDF Reader

🎥 Pete Hawkins published a new video about Building a ChatGPT bot using Ruby on Rails

🎥 Jeremy Smith published a new video about Alternative approach to drag and drop sorting with acts_as_list

✍🏾 Articles

What’s new

Avi Flombaum published the 4th part of their series about An ActiveStorage S3 Direct Uploader: Part 4 - Bonus Features → “Just for fun, I thought we'd add a feature where after the upload is complete we display an audio player for the track that was just uploaded”

Gowsik Vivekanandan published a new article about Rails 7.1 Store secret_key_base In Credentials For Local Environment“In the latest stable version of Rails (Rails 7.0.6), secrets is used for storing the secret_key_base in the local environment. However, from Rails 7.1 onwards, secret_key_base will be moved to credentials”

Gift Egwuenu published a new article about July 2023 RubyGems Updates“As part of our efforts at Ruby Central, we publish a recap of the work that we’ve done the previous month. Read on to find out what updates were made to RubyGems and RubyGems.org in July”

Alkesh Ghorpade published two new articles about what’s new in Rails 7.1: Rails 7.1 adds the ability to raise errors on missing callback actions“Rails 7.1 allows configuring the controllers to raise an error when a callback's only/except options have missing actions” and Rails 7.1 adds the ability to defer the unique constraints in PostgreSQL“Rails 7.1 adds the ability to defer the unique constraints in PostgreSQL. You can use the add_unique_key command and pass the deferrable option to do this. The deferrable option can take two values: immediate and deferred”

Jorge Manrubia published a new article about Difficult and complex “Being able to run a marathon is very difficult. But what you have to do to prepare is simple. A small sheet of paper is enough to describe the steps. You will need tremendous effort and discipline - so it’s hard - but it is simple”

I wrote an article about Insights from Stack Overflow Developer Survey 2023 about Ruby where I share key takeaways about Ruby from the 2023 Stack Overflow Developer Survey.

Kartikey Tanna publish an article about Understanding the Role of the `schema.rb` File in Rails Development → “I've recently had a thought-provoking discussion on LinkedIn Ruby on Rails group about the role of the schema.rb file in Rails development, particularly concerning its authority over the database schema. The conversation evoked mixed reviews, and I thought it might be interesting to bring the topic to dev.to and get more insights”

Deep Dives

Peter Zhu published a deep dive about Two Garbage Collection Improvements Made Our Storefronts 8% Faster“we found two improvements in Ruby’s garbage collector that improved the average garbage collector performance by 46%, which translated to a decrease in average response time by 8% and 99th percentile response time by 25%”

Akshay Khot published two articles this week: One about Using Zeitwerk Outside Rails“This article shows how to use the Zeitwerk gem to autoload classes and modules in a Ruby app that's not using Rails. We'll also learn how Rails configures Zeitwerk internally and introduce the concept of models in our no-rails Ruby web application” and another one about How to Implement Content Security Policy in Rails “This article shows how to implement content security policy in your Rails applications to protect against cross-site scripting (XSS) vulnerability”

Jeremy Friesen published an article about Skipping Your Parent to Go to Your Grandparent: Leveraging Ruby's super_method Method → “Knowing when to break the rules is useful. Explaining why you’re breaking them is crucial. And adding guide/guard rails to help ensure that the assumptions you had when breaking the rules are still in play”

Haseeb A published an article about SQL injection in Rails - Learn from an attacker’s shoes“This guide will guide you through the intricacies of SQL injection in Rails applications, helping you understand the vulnerability itself and how to prevent such a disastrous scenario”

Evgeniy Demin published a new article about Breaking change during Rails upgrade introduced by David Heinemeier Hansson → “I have noticed one strange behavior about how Rails serves static files. It looks like a breaking change because I’m upgrading Rails 5.2 to 6.1. After spending some time debugging it, I decided to share this short story with you”

How-Tos

Mike Coutermarsh published an article about How to stop Rails from setting a session cookie “Recently I was working on a Rails API and I wanted to stop Rails from setting it's _session cookie for API requests”

Harrison Broadbent published an article about Preview emails in Rails with letter_opener, MailCatcher and MailHog “In this article, I'm going to share everything I've learned about email previewing in Rails, and I'm going to show you how to quickly preview emails in your Ruby on Rails apps, using each of these methods (mailer previews, letter_opener, MailCatcher and MailHog)”

Barry Hess published an article about TIL: Rails has_one Nested Attributes Tweaking“In a project I'm working on right now I've been using a Rails nested form and a couple of things caught me off guard”

Nithin Bekal published a new article about Ruby's bang methods - Handle with care! “In Ruby, method names can be suffixed with !. These are often called “bang” methods. This is used to indicate that it is a dangerous counterpart of the non-bang version of the method.I had always thought of “dangerous” to mean that the method mutates the underlying object and returns that object. However, these methods can differ from their non-bang versions in other subtle ways, which surprised me recently”

Matt Brictson published a new article about Safe redirects in Rails 7 “Enforcing canonical URLs by redirecting to params is not safe and may raise an exception. Use strong params with allow_other_host: false for security.”

Raghu Varma Bhupatiraju published an article about Implementing materialized views in Rails “When you have a complex query which takes a lot of time to execute and you want to render the data in a page which will be accessed frequently materialized view is your best option”

Joël Quenneville published an article about Structuring Conditionals in a Wizard“I’ve worked on several projects, both Rails and Elm, where the wizard code had gotten so convoluted that the team were scared to work with it. Applying the refactors shown below had a major impact and allowed everyone to feel confident when dealing with this part of the system”

Tobias L. Maier published an article about Simplifying UI Testing with data-testid in RSpec & Capybara“This blog post explains how to use Test IDs with RSpec and Capybara, and introduces two new RSpec matchers (have_test_id and have_test_id_and_css) to simplify UI testing”

Lucas Barret published a new article about Padle is nice but squash (Rails migration) is funnier → “This is the time and place to learn about migration and try to squash some”

Konrad Badzioch published a new article about Setting up Hanami and Postgres with Docker Composeshowing how to create a Docker image for Hanami

Juraj Kostolanský published a new article about Dark mode using TailwindCSS and Turbo → “The CSS framework I’m using to style LocaleData - TailwindCSS - has a great built-in support for dark mode. It provides a dark variant that lets you style your site differently when dark mode is enabled”

Adrian Valenzuela published a new article about Creating a Ruby Method | Mugen Ruby → “We are going to create a method that reverses a string…ready? Let’s go”

Carlos Castaneda published a new article about TIL Blog - Mini Project “For my mini project I decided to take my love of movies and build a movie search app”

Related

Adam Rice published a new article about Thriving in economic uncertainty “Laying off staff is tough, and it happens due to factors that force management to refocus on efficiency. The challenge, however, is to keep these pressures from eclipsing the importance of maintaining healthy, aligned, and efficient teams”

Ferdia Kenny published an article about Tips for working across timezones “For about a month though I was working with folks based in UTC -4 which meant I came online about 5 hours before my colleagues. This was challenging. However, I found the following tips helped a lot”

I published an article about Bugs, errors and causes from an 1975 paper → “In this article, I share Albert Endres' findings and explore how understanding the problem, effective communication, and domain knowledge play crucial roles in reducing errors”

Julia Evans published an article about Some tactics for writing in public → “I want to explain some tactics I use to try to make the comments on my posts more informative and useful to me, and to try to minimize the number of annoying comments I get”

James Garcia published a new article about My experience with the Agency of Learning “A couple of months ago I was honored to be accepted to join Agency of Learning. Now that I have had some time in the program I wanted to share my experience. Also, hopefully to bring some awareness to the program”

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.