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:

šŸ‘ Our Community

šŸ“… Events

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:

šŸ‘ Ogom shared Osaka RubyKaigi 03

šŸ‘ 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

šŸ‘‰ Yukihiro Matz shared about methods in 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 

šŸ‘‰ 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:

šŸ‘‰ 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:

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!

šŸ—ž Ruby LibHunt published a new edition of the Issue 377 - Two Garbage Collection Improvements Made Our Storefronts 8% Faster

šŸ—ž 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 Compose ā†’ showing 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.