Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Evil Martians 

Inertia.js in Rails: a new era of effortless integration

Authors: Svyatoslav Kryukov, Backend Engineer, and Travis Turner, Tech EditorTopics: Backend, Full Cycle Software Development, Ruby on Rails, React, JavaScript, Tailwind CSS

We want to make Inertia.js more popular within the Rails community, so we've started a project to provide both Rails-specific community docs and a set of tools for simply integrating Inertia into Rails apps.

In her RailsConf Keynote "Startups on Rails in 2024" our CEO Irina Nazarova pointed out the #1 request from young Rails startups–proper React support in the Rails community. Accordingly, we recently unveiled Turbo Mount, which simplifies cases when your app needs just a couple of highly interactive components. But…

Gusto Engineering - Medium 

Gusto Eng Spotlight Series: Alyssa Hester

This blog series is dedicated to celebrating our Black, Latinx, and Women Engineers who are making an impact in the lives of our Gusties and Gustomers (Gusto customers) every day.

Today, we’re spotlighting Alyssa, who has been with Gusto for 4 years and 9 months as a Staff Engineer for the Financial Products team.

A picture of Alyssa with glasses looking to the left

Jeremy: Tell us a little about how you got to Gusto.

Alyssa: Before Gusto I was working at Elastic as a consultant architect. My job required me to travel frequently to meet clients, which meant I was on the road 50% to 60% of the time. I moved to Denver and felt ready to build community and spend less time on the road. I also found myself craving long term ownership of projects and…

Once a Maintainer 

Once a Maintainer: Mike McQuaid

Welcome to Once a Maintainer, where we interview open source maintainers and tell their story.

This week we’re talking to Mike McQuaid, project leader and longest tenured maintainer of Homebrew, a package manager for macOS and Linux used by tens of millions of developers worldwide. After ten years at GitHub, Mike is now CTO of Workbrew, a startup for managing a fleet of machines running Homebrew. Mike spoke with us from Edinburgh, Scotland.

Once a Maintainer is written by the team at Infield, a platform for managing open source dependency upgrades.

What was your first exposure to computers and eventually writing software?

As a kid my first exposure was at my school. We had BBC Micros, which is…

The Bike Shed 

429: Transforming Experience Into Growth

Stephanie has a newfound interest in urban foraging for serviceberries in Chicago. Joël discusses how he uses AI tools like ChatGPT to generate creative Dungeons & Dragons character concepts and backstories, which sparks a broader conversation with Stephanie about AI's role in enhancing the creative process.

Together, the hosts delve into professional growth and experience, specifically how to leverage everyday work to foster growth as a software developer. They discuss the importance of self-reflection, note-taking, and synthesizing information to enhance learning and professional development. Stephanie shares her strategies for capturing weekly learnings, while Joël talks about…

Jardo.dev: Blog 

System tests haven't failed

The topic of system tests (a.k.a. end-to-end tests or feature tests) is making the rounds right now, and I'm a bit confused by it. They've always been a bit of a contentious topic. I've seen people say they only write system tests. I've seen people say they don't write any system tests. I don't want to get called a "centrist", but the best approach is definitely somewhere in between those two poles.

System tests have failed

DHH started the conversation by announcing that system tests have "failed". He claims that he has seen very little benefit to having a large suite of system tests. He reports having spent too much time getting such tests to work for the minimal benefit he has seen from…

Felipe Vogel 

A Rubyist learns Haskell, part 2

Last year I started learning Haskell and then shelved it not long after. I hear that’s a popular thing to do. But I had a great excuse in the toughest job search of my life so far, and now I’m jumping back into Haskell.

Expressing things in different ways

Haskell isn’t always fun for a newcomer. Often it feels like I’m learning programming all over again. It’s tiring and I sometimes feel stupid.

Whenever I feel like quitting,…

RoRvsWild's blog 

Measuring Ruby Garbage Collector

I wanted to measure the GC after reading articles from the Shopify team. Some of their slowest requests are because of garbage collection. I was curious to know if that was the case for RoRvsWild too.

One practical way to observe how garbage collection affects response time is to add GC.start to a controller. Running the GC pauses the request until it has finished. I encourage you to try it in your current localhost application.

Fortunately, there is no garbage collection for each request. However, the garbage collector may have to clean objects from previous requests, and the current request can be slow because of previous allocations. Thus, GC timing on a specific request is not always…

RubyGems Blog 

May 2024 RubyGems Updates

Welcome to the RubyGems monthly update! 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 May.

RubyGems News

In May, we released RubyGems 3.5.10 and 3.5.11 , and Bundler 2.5.10 and 2.5.11. These releases bring a series of enhancements and bug fixes designed to improve the overall developer experience with RubyGems, including: a security update to limit the size of the metadata and checksums files in a gem package, a fix for an issue when plugin stubs would sometimes not be properly removed by gem uninstall, the deprecation of Bundler constants and the…

Short Ruby Newsletter 

Short Ruby News - Edition #95

The one about the Ruby 3.3.3 release together with the Security for Rails developers book pre-sale launch and finding out that Ruby is the highest paying job so far in 2024
a-chacon 

Creating a REST API with Ruby on Rails. Chapter 1: Initial Setup and Models

We laid the foundations of a REST API in Ruby on Rails by designing the database, creating models, and configuring factories for test records. Focused on code scalability and future adaptability.
Hotwire Weekly 

Week 24 - Using React with Hotwire, Refreshing Turbo Frames, and more!

Hotwire Weekly Logo

Welcome to Hotwire Weekly!

Welcome to the another issue of Hotwire Weekly! This edition covers the latest Hotwire articles, videos, and releases.

Happy reading! 🚀✨

📚 Articles, Tutorials, and Videos

The art of Turbo Mount: Hotwire meets modern JS frameworks - Svyatoslav Kryukov published a blog post on the Evil Martians Blog where he talks about his package turbo-mount. Turbo Mount allows to use React, Vue, Svelte, and other components with Hotwire.

How to refresh the full page when submitting a form inside a Turbo Frame? - Radan Skorić published a blog post where he is talking about refreshing a full page when submitting a form inside a Turbo Frame.

Add GPT-4o To Your Rails 7 app: Get…

hexdevs 

Upgrading a Rails 6.1 app to Rails 7.0

A step by step of how to prepare for it, how to get to Rails 7, and what to do after the upgrade.
Alchemists: Articles 

Beneficial Ownership Information

Cover
Beneficial Ownership Information (BOI)

The BOI filing requirement stems from the Corporate Transparency Act (CTA) enacted in 2021 and took effect on January 1st, 2024. The CTA is a federal law that requires certain types of businesses, including Limited Liability Companies (LLCs), to report information about their beneficial owners to the Financial Crimes Enforcement Network (FinCEN), a bureau of the U.S. Department of the Treasury. According to Congress, without the CTA, individuals would benefit from hiding illegal operations through these business entities. The CTA and BOI are meant to make this harder to accomplish.

This article is meant to serve as a public service announcement…

avdi.codes 

Anything but Brevo

It is very easy to be blinded to the essential uselessness of them by the sense of achievement you get from getting them to work at all. In other words—and this is the rock solid principle on which the whole of the Corporation’s Galaxy-wide success is founded—their fundamental design flaws are completely hidden by their superficial design flaws.

Douglas Adams, The Hitchhiker’s Guide to the Galaxy

When you set out to choose your your autoresponder, aka CRM, a lot of resources will point you to Brevo (formerly SendInBlue). I think this is because among mature email general-purpose email CRMs, they are comparatively cheap at the low end. And on paper they offer every possible feature you…

Honeybadger Developer Blog (Ruby Articles) 

Curated dashboards in Honeybadger

Earlier this year, we introduced a new logging and performance monitoring tool, Honeybadger Insights. You can finally send your logs, application events, and telemetry data to Honeybadger! Once you do, you can query your logs and events to diagnose performance issues, perform root-cause analyses, and create beautiful charts and dashboards to see what's happening in real time.

We first launched Insights as a general-purpose tool in your monitoring toolkit; you could use it for many different things, but how you used it was up to you. Today, we're introducing two new features that make it much easier to get started:

  1. Pre-built performance dashboards. Instead of creating a dashboard…
RubyGems Blog 

3.5.13 Released

RubyGems 3.5.13 includes enhancements and bug fixes.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Enhancements:

  • Installs bundler 2.5.13 as a default gem.

## Bug fixes:

  • Never remove executables that may belong to a default gem. Pull request #7747 by deivid-rodriguez

SHA256 Checksums:

  • rubygems-3.5.13.tgz
    10a27b5b959e87959a0c86b091cf2b88117b2987c40628a011623aca7fd8ae0b
  • rubygems-3.5.13.zip
    438ccb149aff4ed055afa02170c704f71451658fbf78e7c4003633f71d554513
  • rubygems-update-3.5.13.gem
    d66895fea6e7cec14e6a6c26c5ce485b463a73c4be4ee6a5ba4774a7bdd2c0c3
Ruby on Rails 

New transaction event, bugfixes and more!

Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.

Only sanitize content attribute when present in attachments
A recent security fix introduced sanitizing the content attribute of ActionText::Attachable::ContentAttachment. As a side effect it always sets the attribute, even when it’s missing, causing Trix to not show the image preview. This pull request fixes that issue.

Bring back puma.rb to target of app:update
Because Rails has improved puma.rb in the past a few times, rails app:update will update the file in the future releases.

Define the a start_transaction.active_record event
With this change, a new start_transaction.active_record event will be emitted when a…

Remote Ruby 

Rails 7.2 beta 1 with the GoRails Gang

In this episode, host Chris and his GoRails team, Collin Jilbert and Kent Crutchfield,
discuss the latest release of Rails 7.2, highlighting major new features like development
containers, browser version guard, and the new minimum Ruby version. They also
delve into community reactions, including some criticisms about Rails' speed and the
larger discourse around development priorities. The conversations emphasize the
importance of contributing to Rails, staying informed on updates, and promoting the
positive aspects of the Rails community. Hit download now to hear more!

Honeybadger
Honeybadger is an application health monitoring tool built by developers for developers.

Disclaimer: This post…
Josh Software 

Unforgettable Experiences: The Impact of Storytelling in UX Design

The role of a UX designer goes beyond just crafting visually appealing interfaces. It is about creating seamless, intuitive experiences that leave a lasting impression on users. At the core of UX designing lies storytelling – a potent tool that allows designers to connect with users on a deeper level and craft experiences that truly … Continue reading Unforgettable Experiences: The Impact of Storytelling in UX Design
Hi, we're Arkency 

How to add index to a big table of your Rails app

How to add index to a big table of your Rails app

When your application is successful, some of the tables can grow pretty big — I’m looking at you users table. If you’re curious enough, you periodically check how your database performs. If any slow query pops up in the metrics, there’s a great chance that some index is missing.

State of the DB engines

While most modern database engines can create indexes in an asynchronous, non–blocking manner, it’s good to get familiar with all the exceptions from this rule. I highly recommend reading the documentation of PostgreSQL, MySQL. I’m not sure about SQLite here as the documentation doesn’t clearly state that. However, my quick chit–chat with…

zverok's space 

The design decisions and evolution of a method definition - Ruby case study

This is the first part of what’ll hopefully become a new series and potentially even a book. It is dedicated to studying various elements of Ruby programming language design decisions, how they evolved with time, and how they look in a wider context.

This part is dedicated to method definitions—their general shape and ways to specify arguments. While the topic might seem relatively small, it allows us to take a clearly visible path through a vast design space and see how the language spirit and its initial design decisions shape further evolution.

Also, it might seem weird to choose methods as a starting point to talk about an object-oriented language’s design, but in Ruby’s case, it is…

Ruby Rogues 

Mastering API Testing: Using Shoulda Matchers and Super Diff in Ruby - RUBY 640

Elliot Winkler is a Staff Software Engineer, Shared Libraries at MetaMask. This episode blends a diverse range of topics, from casual gaming to innovative testing approaches. They explore Elliot's transition to JavaScript and TypeScript at MetaMask while maintaining his Ruby roots through open-source projects like Shoulda Matchers. They also talk about the history and purpose of these matchers, their role in testing Ruby on Rails applications, and the intelligent diffing capabilities of Super Diff. So, sit back and get ready for a deep dive into the world of Ruby, testing methodologies, and a bit of fun along the way!

Socials

Picks


Awesome Ruby Newsletter 

💎 Issue 421 - Async Ruby on Rails

RubyGems Blog 

3.5.12 Released

RubyGems 3.5.12 includes enhancements and bug fixes.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Enhancements:

  • Installs bundler 2.5.12 as a default gem.

## Bug fixes:

  • Fix gem uninstall unresolved specifications warning. Pull request #7667 by deivid-rodriguez
  • Fix gem pristine sometimes failing to pristine user installed gems. Pull request #7664 by deivid-rodriguez

SHA256 Checksums:

  • rubygems-3.5.12.tgz
    032ee73938e04f99247df5f6c3c262b9dbd67f87cb6d5fe1feeef69526fd21fa
  • rubygems-3.5.12.zip
    9f70f2719c041e6d0c0e948b7f3304a362d0cd9bca203c577854a4b0a68bbdb8
  • rubygems-update-3.5.12.gem
    bfa0b7…
Ruby Weekly 

Matz's Ruby syntax moratorium

#​707 — June 13, 2024

Read on the Web

Ruby Weekly

Ruby 3.3.3 Released — The latest production-happy release of Ruby is here with no new features, but several updates to important dependencies (e.g. RubyGems and REXML) and bug fixes. A safe and sensible update to hop on.

Takashi Kokubun

Matz Announces a Syntax Moratorium Until 3.4 — At the end of RubyKaigi, Matz announced that there would be no syntax changes (outside of bug fixes) until Ruby 3.4 is released later this year.

Yukihiro 'Matz' Matsumoto

Rails LTS by Makandra: Support for Old Rails Versions — Get support for old Rails versions…

Rails Designer 

How Layouts Work in Rails

Layouts in Rails have been around since the earlier versions. They define the surrounding HTML structure shared by multiple views, allowing you to implement a consistent visual design. They encapsulate shared site elements like partials and ViewComponent like: headers, footers, and navigation bars. This allows you have a consistent “chrome” for every view of your app, but also have invisible elements added onto every page, like JavaScript snippets.

Most Rails developers easily grasp the idea of layouts, but not all know the inner workings of layouts in Rails. Let’s go over the most important parts.

How content is rendered in layouts

The central mechanism in layouts for embedding…

Ruby on Rails 

Meet TableCheck, the newest Contributing member of the Rails Foundation

Amid the work taking place to improve the Rails documentation and prepare for Rails World, we are happy to take a break and introduce the newest Contributing member of the Rails Foundation: TableCheck.

TableCheck is a restaurant booking and guest experience platform serving over 10,000 venues across 35 countries, including many of the world’s largest hospitality brands. Headquartered in Tokyo, Japan, TableCheck helps restaurants reduce their reliance on paid booking channels by converting first-time diners into repeat guests—and repeat guests into loyal fans.

TableCheck was founded by CEO Yu Taniguchi and CTO Johnny Shields and has used Rails since its initial product launch in 2013.…

Notes to self 

Understanding Kamal healthcheck settings

Here’s what you should know about Kamal healthchecks, namely the Docker healthcheck and the new Kamal 1.6 web barrier.

Docker healthcheck

Every running Docker container can come with a healthcheck. A typical web role container running with Kamal might have a following healthcheck:

$ docker inspect [CONTAINER_ID] --format ""
{"Test":["CMD-SHELL","(curl -f http://localhost:3000/up || exit 1) && (stat /tmp/kamal-cord/cord > /dev/null || exit 1)"],"Interval":5000000000}

This heathcheck marks containers either healthy or unhealthy.

There are two things going on:

  • First, there is a test for an /up endpoind on port 3000. That’s application-specific check.
  • Second, there is a Kamal’s cord

Application check

Standard Rails 7.1 application will run on port 3000 with a…

The Ruby on Rails Podcast 

Episode 517: Rails Conf 2024 Crossover: Off The Rails

At Rails Conf 2024, I gathered several of our favorite ruby podcasters for a giant crossover episode! In this episode we have:

Sponsors
Honeybadger

As an Engineering Manager or an engineer, too much of your time gets sucked up with downtime issues, troubleshooting, and error tracking. How can you spend more time shipping code and less time putting out fires?

Honeybadger is how. It’s a suite of…

Saeloun Blog 

ActiveStorage::Blob#compose Now Supports Custom Blob Key in Rails 7.2.

The ActiveStorage::Blob#compose method allows us to combine more than one Active Storage blobs into a single, unified blob.

This method is helpful when we create composite files (for example, integrating an audio track with its lyrics) or generating integrated documents from multiple components.

ActiveStorage Compose Method

ActiveStorage::Blob.compose(blobs, filename:, content_type: nil, metadata: nil)

Rails 7.2, adds a new parameter key that allows us to have custom key, similar to other Blob API’s

Example

Here’s a code example demonstrating how to pass the custom key to the compose method:

# Assuming we have blobs for audio (music.mp3) and lyrics (lyrics.txt)

audio_blob = ActiveSt…
Saeloun Blog 

BatchEnumerator#destroy_all To Return The Total Number Of Destroyed Records

The BatchEnumerator in Rails is a utility that allows processing large sets of records in smaller, more manageable batches.

This approach helps to avoid loading large datasets into memory all at once, which can be inefficient and slow.

The in_batches method provides a way to iterate over records in batches, applying actions to each batch sequentially.

The recent PR in Rails brings a significant improvement to the BatchEnumerator#destroy_all method.

Previously, this method returned nil after destroying records in batches, providing no feedback on the number of affected rows.

From Rails version 7.2, it will now return the total number of destroyed records.

Before

Prior to the…

Ruby Magic by AppSignal 

Monitor the Performance of Your Ruby on Rails Application Using AppSignal

In the first part of this article series, we deployed a simple Ruby on Rails application to DigitalOcean's app platform. We also hooked up a Rails app to AppSignal, seeing how simple errors are tracked and displayed in AppSignal's Errors dashboard.

In this part of the series, we'll dive into how to set up the following for your Ruby on Rails application using AppSignal:

  • Performance monitoring
  • Rails background jobs monitoring, including how to monitor simple API calls
  • Logging
  • Notification alerts

Let's get into it!

Monitoring Rails App Performance Using AppSignal

When your uptime monitor shows that your app is up, it may be tempting to think that everything is okay. But, in reality, trouble…

Ruby News 

Ruby 3.3.3 Released

Ruby 3.3.3 has been released.

This release includes:

  • RubyGems 3.5.11
  • Bundler 2.5.11
  • REXML 3.2.8
  • strscan 3.0.9
  • --dump=prism_parsetree is replaced by --parser=prism --dump=parsetree
  • Invalid encoding symbols raise SyntaxError instead of EncodingError
  • Memory leak fix in Ripper parsing
  • Bugfixes for YJIT, **{}, Ripper.tokenize, RubyVM::InstructionSequence#to_binary, --with-gmp, and some build environments

Please see the GitHub releases for further details.

Download

Alchemists: Articles 

Big Sky Dev Con 2024

Cover
Big Sky Dev Con 2024

I attended Big Sky Dev Con for the first time this year and, to quote directly from the web site, is:

A technology conference put on by Montana Programmers held each Summer in Bozeman, Montana. BSDC is dedicated to sharing knowledge with the Montana community about Software Development, Tech Business, Design, and User Experience.

While the above may be true, the running joke during the conference was this was more a htmx conference and, to be honest, was the main reason for me attending especially since I’m the creator/maintainer of the HTMX gem and htmx Remove library. The htmx influence is due to Big Sky Software being the force behind htmx while also…

The…

BigBinary Blog 

How we build, release and maintain frontend packages

Here at neeto, we build and manage alot of products. Eachproduct has its team. However, ensuring consistent design and functionalitiesacross these products poses a significant challenge. To aid our product teams infocusing on their core business logic, we've organized common functionalitiesinto separate packages.

In this blog, we'll look into how we build, release and maintain these packagesto support our product development cycles. Let's take a look at some of thesekey packages.

neeto-cist

neeto-cist contains essential pureutility functions and forms the backbone of our development framework.

neeto-ui

neeto-ui is the foundational designstructure for our neeto products. It contains basic-level…

Evil Martians 

The art of Turbo Mount: Hotwire meets modern JS frameworks

Authors: Svyatoslav Kryukov, Backend Engineer, and Travis Turner, Tech EditorTopics: Backend, Full Cycle Software Development, Hotwire, Ruby on Rails, React, JavaScript

Explore the fusion of Hotwire simplicity and JavaScript interactivity using the integration of Turbo Mount and React, Vue, or Svelte components for a dynamic and responsive user experience.

DHH once likened Rails developers to Renaissance artists: full-stack virtuosos, like Leonardo da Vinci, who dabbled in engineering, painting, and everything under the sun. Emboldened by such high praise, I wanted to create something as beautiful, simple, and timeless as the smile of the Mona Lisa. Thus, recognizing that the current frontend…

Saeloun Blog 

Ruby 3.4 Throws SyntaxError As Keyword Arguments Are No Longer Allowed In Index.

In Ruby, keyword arguments in index refers to the practice of passing a keyword as an argument to an array, particularly when accessing or modifying elements within an array.

project_details = { status: "ongoing" }
projects = []

def projects.[]=(*args, **keyword_args)
  puts "args: #{args}"
  puts "keyword_args: #{keyword_args}"
end

Before ruby 3.3

keyword arguments were treated as positional arguments.

projects[1, status: "completed"], _ = ["Project A updated", "Project B"]

=> args:         [1, {:status=>"completed"}, "Project A updated"]
=> keyword_args: {}
projects[2, **project_details], _ = [{budget: 10000}, "Project C"]

=> args:         [2, {:status=>"ongoing"}, {:budget=>10000

In ruby 3.3

Use of keyword arguments in multiple assignment is broken in 3.3

projects[1, s…
Radan Skorić's personal site 

How to refresh the full page when submitting a form inside a Turbo Frame?

Let’s consider some UI examples and mentally check if we can get the Turbo magic by just slapping a Turbo Frame in the right place. By that I mean: can we make the implementation really as simple as plain HTML with “the speed of a single-page web application”: Navigating full pages of content. ✅ Links that change a fixed different part of UI, like tabs. ✅ Navigating a self contained smal...
Notes to self 

Implementing dark mode with Tailwind and Stimulus

About to implement a dark mode into your Rails app? Here’s one way using Tailwind and Stimulus.

Dark mode

Dark mode can be automatic based on system settings or manual based on user action.

The preference for dark mode will be based on the prefers-color-scheme: dark media selector and a custom settings in localStorage. If you don’t need a custom switch you could implement this all just with the media selector and Tailwind.

The dark theme itself will work based on adding a dark CSS class to the html element. We’ll then configure Tailwind to use this selector to drive the theme change.

Stimulus

Stimulus controller needs to support a toggle action for manual switching and a way to get…

Rails, PostgreSQL Performance Audit and Tuning Consultant for Hire 

How to Optimize MEV Arbitrage Smart Contract with Yul and Huff

Minimizing gas usage directly impacts the profitability of your MEV bot. In this blog post, we will start with a straightforward but nonoptimal approach for swapping two UniswapV2 pairs and gradually improve it. We will start with Solidity-level fixes and later descend into the lower layers of the Ethereum EVM with Yul and Huff assembly languages.

Disclaimer: The information provided in this blog post is for educational purposes only and should not be treated as financial advice.

What to expect from this post?

We will not build a competitive MEV bot here. Instead, we will discuss various EVM gas optimization techniques and measure their impact. This knowledge should be applicable to any…

Josh Software 

Breaking Barriers: Unveiling the Power of Hindi Text-to-Speech on Windows

Text-to-Speech (TTS) technology is a computerized system that converts written text into spoken words. In simpler terms, it allows your computer to read out loud the text you see on the screen, making it accessible and convenient, especially for those who may have difficulty reading or prefer auditory information. Importance of TTS in Making Technology … Continue reading Breaking Barriers: Unveiling the Power of Hindi Text-to-Speech on Windows
Short Ruby Newsletter 

Short Ruby News - Edition #94

The one about book discounts, RubyConf CFP open, YJIT performance benchmarks, and many code samples.
The Bike Shed 

428: Ruminating on Ruby Enumerators

Joël explains his note-taking system, which he uses to capture his beliefs and thoughts about software development. Stephanie recalls feedback from her recent RailsConf talk, where her confidence stemmed from deeply believing in her material despite limited rehearsal. This leads to a conversation about the value of mental models in building a comprehensive understanding of a topic, which can foster confidence and adaptability during presentations and discussions.

The episode then shifts focus to the practical application of enumerators in Ruby, exploring various mental models to understand their functionality better. Joël introduces several metaphors, such as enumerators as…

Gusto Engineering - Medium 

Exploring Early Career — Part 4: Preparing for Performance Reviews

Exploring Early Career — Part 4: Preparing for Performance Reviews

Co-authored by Jessica Fan

Stepping into a new career, whether you’re a recent graduate or shifting your professional focus, can feel overwhelming. Effectively navigating your new environment while expanding your knowledge and network presents a challenge that, if approached with care, can foster professional growth in many rewarding ways. In the early stages of your career, the choices you make and the resources you leverage can significantly shape the way in which you impact your community and contribute as a developer!

This series will outline tips and strategies that will make this daunting endeavor a bit more digestible…

Evil Martians 

The lion's den: NestJS and authentication with AWS Cognito

Authors: Yuri Mikhin, Frontend Engineer, and Travis Turner, Tech EditorTopics: Frontend, Full Cycle Software Development, Backend Development, TypeScript, Node.js, Amazon Web Services

Read how we complete the full stack circle and integrate AWS Cognito authentication with NestJS.

I've heard of many cases where developers (specifically, those with Node.js experience) have reported that NestJS is very much a stable and solid solution ready for enterprise-level production. But then, what if we want to add AWS Cognito to the mix? Let's cover the lion's share of the steps you'll need to take to make it all work.

Rails Designer 

How to disable Rails Form’s `.field_with_errors`

This is a quick one! 🚤💨

Rails is known for great defaults and conventions. But there’s one feature that I disable in all my Rails apps.

That feature is field_with_errors (coming from ActiveModelInstanceTag). If there are any form validation errors for a field, this method wraps it with a div.field_with_errors. In turn you can write CSS like this to style it accordingly:

.field_with_errors input,
.field_with_errors textarea,
.field_with_errors select {
  background-color: #ffcccc;
}

But the extra div, more often than not, messes up the flow of the (carefully) crafted HTML and thus breaks the layout.

More importantly I prefer to write my own components to highlight form validation…

Hotwire Weekly 

Week 23 - New Hotwire Browser Extension, Concurrent Updates with Stimulus, and more!

Hotwire Weekly Logo

Welcome to Hotwire Weekly!

Welcome to the another issue of Hotwire Weekly!

Next week Baltic Ruby is scheduled to happen on the 13—15th of June in Malmö. Marco Roth will be there and host an OSS expo campfire to talk about all things HTML-over-the-wire. If you are also going to be there make sure to step by and say Hi!

Happy reading! 🚀✨

📚 Articles, Tutorials, and Videos

Update a Progress Bar using Turbo Streams (using Custom Actions) - Rails Designer published an article in which they are using Custom Turbo Stream Actions to update the value of a progress bar.

Smooth Concurrent Updates with Stimulus - Michał Łęcicki published a blog post where he is using Stimulus and Turbo Stream…

Drifting Ruby #459 -…

avdi.codes 

Dammit, Descript, I want to like you

@DescriptApp is like the perfect flytrap for amateur video editors. You want it to work so bad because if it did it would be PERFECT but you wind up killing hours on it because every single thing it does is buggy.

Today’s bugs:

  1. Single black frame in between clips that is impossible to eliminate and breaks transitions
  2. Color picker is broken. It’s looking at a different part of the screen than you are pointing at, and even when you adjust for the offset it STILL picks a random color from somewhere else.
  3. Still no “shadow” effect for objects (?!)
  4. It offers to make video proxies (but calls them something different) for clips that stutter during editing, but then the…

Meanwhile Premiere has added edit-by-transcript feature, which was like 75% of the reason to use Descript. (The other 25% is collaboration)

Come on, Descript. I am giving you money and I want to like you, but you’re making it difficult.

P.S. OMG local video export is SO…

avdi.codes 

Missive is amazing

I have a lot of frustrations with a lot of products but every now and then I take a step back and realize there’s something I use every day and it’s SO GOOD I never think twice about it. Today’s example: Missive. I moved to Missive after Front drifted too far down the Enterprise Riptide.

I don’t know where to start on how good Missive is. If you need to share an email inbox with one or more other people in an organization, it’s just perfect. I even use it to process my personal email now.

I didn’t write this post for the purpose of getting kickbacks, but after I wrote it I checked and I do have a referral link. So, click here if you want to try out Missive and kick me a discount.

Ruby Rogues 

Ruby Evolution with Bridgestone - RUBY 639

In this episode, they delve into the world of Bridgetown - a progressive site generator and full-stack framework powered by Ruby. Ayush shares his journey of discovering and contributing to Bridgetown, leading to career opportunities in freelancing. The team discusses the platform's capabilities, deployment aspects, and advanced customization using Ruby. They also explore the limitations and possibilities of Bridgetown, including themes and CSS frameworks. Join them for an insightful discussion on the evolving landscape of static site generation and the innovative potential of Bridgetown.

Socials

Picks
Giant Robots Smashing Into Other Giant Robots 

Async Ruby on Rails

Async programming can make your apps faster. I’ll share how you can use async in Ruby on Rails to speed up your app. While there are examples in Ruby, the principles apply to any language.

If you want an introduction to async programming or prefer a video format, I also gave a talk about it at Tropical.rb 2024.

I’ll group the examples into two basic principles. Here’s the first one:

Don’t do now what you can do later

Delay doing stuff as much as possible. Being lazy is not necessarily a bad thing. In practice, that means a few things:

Pay attention when you use a method that ends with _now. They’re strong candidates for things that can be done async. A common example…

Hi, we're Arkency 

Conditionally Enable GZIP on Heroku with Rack::Deflater: Reduce Response Size Significantly

Conditionally Enable GZIP on Heroku with Rack::Deflater: Reduce Response Size Significantly

If you came here after searching for something like “rack deflater path condition” or “rack deflater if option,” here is your answer:

config.middleware.use(
  Rack::Deflater,
  :if => lambda do |env, _, _, _| 
    env["PATH_INFO"] == "/your/endpoint/path/here" 
  end
)

Just insert this line in your application.rb, and you’re set. We could wrap up this post here, but… But we all know that we should not take a piece of random information from the Internet for granted. No matter what the most advanced, AI-powered search engines in the world may suggest, adding non-toxic glue to pizza sauce is never…

Remote Ruby 

Railsconf and Tech Debt

In this episode, Jason and Chris chat about their experiences at various RailsConf and
RubyConf’s. Then, they have deeper discussions on topics like transitioning from Single
Table Inheritance (STI) to delegated types in coding, addressing technical debts in
product development, and the challenges and strategies of implementing subscription
and one-time payment models. Additionally, there's a mention of the 2024 Ruby on
Rails Community Survey at Planet Argon that you can check out now. Hit download now
to hear more!

Honeybadger
Honeybadger is an application health monitoring tool built by developers for developers.

Disclaimer: This post contains affiliate links. If you make a purchase, I may…
Ruby on Rails 

Global strict loading mode setting, route draw deferring and more

Hi, Wojtek here. Let’s explore this week’s changes in the Rails codebase.

Rails security releases
Rails Versions 6.1.7.8, 7.0.8.4, 7.1.3.4, and 7.2.0.beta2 have been released with a security issue fix.

The CFP for RubyConf is open
Submissions on all Ruby Web Frameworks, including Rails, will be considered, so get your Rails related submissions ready!

Allow to set strict_loading_mode globally
Sets the mode via config.active_record.strict_loading_mode in which strict loading is reported. Defaults to :all. It can be changed to :n_plus_one_only to only report when loading associations that will lead to an “N + 1 query”. This can be set globally or within a model.

Defer route drawing to the…

Awesome Ruby Newsletter 

💎 Issue 420 - Why Ruby's Timeout is dangerous (and Thread.raise is terrifying) (2015)

Ruby Weekly 

Making debugging with puts cool again

#​706 — June 6, 2024

Read on the Web

Ruby Weekly

Bundler Auto-Install Just Got a Whole Lot Better — Bundler has a handy new feature. As of Bundler 2.5.10, you can now enable the auto_install config to have Bundler automatically install your bundle on demand, which might be particularly handy when working on a project with others.

Ngan Pham (RubyGems)

Omakub: DHH's 'Omakase' Developer Setup for Ubuntu 24.04 — DHH, no stranger to specifying his preferred conventions generally, now has a script that will turn an Ubuntu machine into a “modern web development system.” On the menu are dotfiles, a terminal…

Ruby Central 

Performance, AI, Weird Ruby and Matz: The RubyConf 2024 CFP is Open

Join a Lineup of Technical Talks and an In-person Keynote by the Ruby Language Creator

PASADENA, C.A. (June 6, 2024) – Ruby Central, Inc., has just opened the CFP for RubyConf 2024. RubyConf is the world's largest and longest-running gathering of Ruby enthusiasts, practitioners, and companies. This year’s event is happening Wednesday, November 13 to Friday November 15, 2024 in Chicago, IL. 

This year, Ruby Central is curating a more technical program than in previous years. Inspired by Ruby Kaigi in Japan, the conference will feature more technical talks from people contributing to the Ruby language itself. If there is interest, the program committee may even add a Kaigi track.

“We’re looking…

Greg Molnar 

Framework 16 - First impressions

Almost 2 years ago, I decided to switch from a Macbook to a Framework. Back then, they only had a 13” option and even though I felt that screen will be too small for me, to support the company I ordered one. Initially, I found the whole device tiny, but then I got accustomed to it and it became my daily driver.

Rails Designer 

Update a Progress Bar using Turbo Streams (using Custom Actions)

When Turbo Streams was announced they allowed you to do a handful actions, like prepend, replace, focusing on your HTML.

Fast-forward, and through this PR it’s now possible to create your own actions. This means everything you can normally do with JavaScript you can do using Turbo Streams.

There is this great article by Marco Roth that explains the basics—check it out.

Setting the stage

I have a report feature, that gathers data, does some calculations and then creates a PDF off of it.

This is some intensive data wrangling, so it makes sense to put it into one or many background jobs. For a great UX the goal is to let the user know about the progress.

What is needed:

  • report model (…
Jake Zimmerman 

A trick for invariant generics in Sorbet

There's a neat trick for using generic methods to get around some of the limitations that invariant type members in generic classes carry.
Jake Zimmerman 

Old vs new case statement in Ruby

A quick note on why I prefer Ruby's old case/when syntax over the new pattern matching syntax with case/in.
RubySec 

CVE-2024-28103 (actionpack): Missing security headers in Action Pack on non-HTML responses

Permissions-Policy is Only Served on HTML Content-Type The application configurable Permissions-Policy is only served on responses with an HTML related Content-Type. This has been assigned the CVE identifier CVE-2024-28103. Versions Affected: >= 6.1.0 Not affected: < 6.1.0 Fixed Versions: 6.1.7.8, 7.0.8.4, and 7.1.3.4 Impact ------ Responses with a non-HTML Content-Type are not serving the configured Permissions-Policy. There are certain non-HTML Content-Types that would benefit from having the Permissions-Policy enforced. Releases -------- The fixed releases are available at the normal locations. Workarounds ----------- N/A Patches ------- To aid users who aren't able…
RubySec 

CVE-2024-32464 (actiontext): ActionText ContentAttachment can Contain Unsanitized HTML

Instances of ActionText::Attachable::ContentAttachment included within a rich_text_area tag could potentially contain unsanitized HTML. This has been assigned the CVE identifier CVE-2024-32464. Versions Affected: >= 7.1.0 Not affected: < 7.1.0 Fixed Versions: 7.1.3.4 Impact ------ This could lead to a potential cross site scripting issue within the Trix editor. Releases -------- The fixed releases are available at the normal locations. Workarounds ----------- N/A Patches ------- To aid users who aren't able to upgrade immediately we have provided patches for the supported release series in accordance with our [maintenance…
All about coding 

Endless method - a quick intro

Quick introduction to the endless method in Ruby, exploring use cases and potential impacts on code structure
Ruby Magic by AppSignal 

How to Use Tailwind CSS for Your Ruby On Rails Project

It's hard to overstate the importance of Cascading Style Sheets (CSS) for all websites. Since the first CSS standards were published in late 1996, we have come quite far regarding features and ecosystems.

Several frameworks have appeared and proved popular, one of the most recent being Tailwind CSS.

In this post, we'll first examine Tailwind's utility-first approach before diving into how to use it in a Ruby on Rails application. You will see how Tailwind helps you to build excellent websites without the need for custom CSS and long debugging sessions.

Let's get started!

Tailwind CSS: A Utility-First Approach

Most CSS frameworks (Foundation, Bootstrap, or Bulma, for example) provide…

Andy Croll 

Compress Your Images

Images typically form a large proportion of the total download size of pages in your Rails application.

Given that many image formats (both lossy and lossless) can be compressed further without any visual regression, it makes sense to optimize them up until that point.

Create a Github Action

Add the following to your repository:

# .github/workflows/compress-images.yml

name: Optimize Images

on:
  pull_request:
    paths:
      - "**.jpg"
      - "**.jpeg"
      - "**.png"
      - "**.webp"

jobs:
  build:
    if: github.event.pull_request.head.repo.full_name == github.repository

    name: calibreapp/image-actions
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        us…

Why?

Smaller images mean faster downloads for your users. This is a great set-and-forget tool from the…

Saeloun Blog 

Explore new hooks coming up in React 19

The React 19 RC was released on April 25, 2024. It introduces a range of new features set to transform React development. Contrary to popular belief, the React team isn’t only focused on React Server Components and Next.js. The upcoming release emphasizes web primitives and form data being one of those primitives.

Consider this simple example where we are using the useState hook to manage isPending and data, message. It works fine but there is quite a lot of boilerplate to handle data, isPending, and message states.

export default function App() {
const [name, setName] = useState('');
const [message, setMessage] = useState(null);
const [isPending, setIsPending] = useState(false);

const s…
Giant Robots Smashing Into Other Giant Robots 

3 Mental Models For Ruby Enumerators

I love to collect mental models. These give me a lens (sometimes several!) for thinking about a given type of problem. For example, thinking of reduce as a tool to scale a method that combines 2 items to a method that combines n items helps me simplify complex reduce functions.

Ruby’s Enumerator (the class, NOT the Enumerable module!) can be a bit tricky to wrap your head around. Here are 3 different mental models I have for it:

  1. An Enumerator is a cursor over a list
  2. An Enumerator is a lazy list
  3. An Enumerator is a series generator

Cursor

A diagram showing a list of 4 elements with a cursor paused on item 2

Ruby’s Enumerator can be thought of as a cursor within a collection. Unlike an array that has no sense of position, an enumerator…

katafrakt’s garden 

Improving upserts in Ecto and PostgreSQL

Upserting is a very useful technique for working with databases. One of the most common use cases is when you are mirroring data from a different data source (different database or an API, for example) in your application’s local database. Ecto supports it quite well and has a dedicated section of its documentation about it. However, I found this can be improved even further, and I will show you how.

If you are familiar with upserts in general, you can safely skip the next three sections, where I explain what they are and what purpose they serve.

What is an upsert?

An upsert is basically “update or insert”. You try to insert a new record, but if inserting fails because of violating some…

Ruby on Rails 

Rails Versions 6.1.7.8, 7.0.8.4, 7.1.3.4, and 7.2.0.beta2 have been released!

Hi everyone!

Rails Versions 6.1.7.8, 7.0.8.4, 7.1.3.4, and 7.2.0.beta2 have been released!

These are security releases, so please upgrade at your earliest convenience.

Here is a list of security issues that these releases address:

Here are the shasums for the released gems:

11292f721ae2414534de6c04c34a2c356fde0de0  actioncable-6.1.7.8.gem
2eac49b6424ced0227f026fd15178abed2dd6882  activerecord-6.1.7.8.gem
3b2cb8ee31fdeb303d769d751031482c31d68ae6  railties-6.1.7.8.gem
4ea9c7a2a8d4a7522ebe0f9a01d01cc0d07e0aee …
GarrettDimon.com Posts 

Fine-tuning Text Inputs

Web forms and inputs support a variety of additional attributes that can provide hints to the browser and improve the user experience of filling out forms online. With the tiniest bit of extra effort, we can make sure our forms help rather than hinder.

Test Double 

How to synchronize JSON date formats for accurate data comparison

Recently, a client asked me to compare the sort orders of results from calls to their new system and the one it’s replacing. This was intended as a one-time validation, and I was not expected to find any discrepancies. The responses were both in JSON format, and a colleague suggested that jq would be a good tool to use. I had no idea what that was or how to use it, so of course I took the advice.

The jq app is a command line tool that can read JSON, process the data, and create new files. My plan was to extract the data I needed to compare into files of identical format and then run a diff on them. Simple. In theory.

Unfortunately, data is fickle. All manner of inconsistencies in…

Rails Designer 

PayPal is Now Accepted

Starting today you can get a copy of Rails Designer using PayPal. Head over to Get Access, choose your preferred option and on the next screen select PayPal.

Preview of the Stripe checkout with the PayPal option

Short Ruby Newsletter 

Short Ruby News - Edition #93

Conferences announced their lineups and agenda, Ruby 3.3.2 was released, Rails 7.2 beta was announced, and a wide range of code samples and discussions.
Honeybadger Developer Blog (Ruby Articles) 

How to build a Rails API with rate limiting

APIs are the bread and butter of the internet. The ability to interact with our applications programmatically enables interoperability and makes our lives as developers easier. Unfortunately, web applications are vulnerable to malicious actors that seek to misuse them or degrade their performance, which is why rate limiting is an important part of any API. This guide will walk you through using Ruby on Rails to make an API application that manages an animal shelter, and we'll also integrate rate limiting with rack-attack! We'll keep track of cats, dogs, and volunteers through a JSON interface.

You can follow along with the example app we create and even see the source of the final app here…

Honeybadger Developer Blog (Ruby Articles) 

Blue Ridge Ruby is exactly what we need

It's 12:04 pm on a Saturday, and I'm sitting in a sleepy cafe in Asheville, North Carolina—the perfect place to reflect on the past few days of thoughtful presentations, engaging conversations, and delicious meals with my new and old friends at Blue Ridge Ruby.

Blue Ridge Ruby is a two-day single-track conference in Asheville, North Carolina. Asheville is nestled in the Blue Ridge Mountains at the confluence of the Swannanoa and the French Broad rivers, where you can take in the local art scene at the River Arts District, hike in the surrounding mountains, settle down at a local cafe, or enjoy the many bars, concert venues, and other nightlife attractions. Asheville is a town where…

Julia Evans 

New zine: How Git Works!

Hello! I’ve been writing about git on here nonstop for months, and the git zine is FINALLY done! It came out on Friday!

You can get it for $12 here: https://wizardzines.com/zines/git, or get an 14-pack of all my zines here.

Here’s the cover:

the table of contents

Here’s the table of contents:

who is this zine for?

I wrote this zine for people who have been using git for years and are still afraid of it. As always – I think it sucks to be afraid of the tools that you use in your work every day! I want folks to feel confident using git.

My goals are:

  • To explain how some parts of git that initially seem scary (like “detached HEAD state”) are pretty straightforward to…
Hi, we're Arkency 

How to use Hotwire Turbo Streams effectively?

How to use Hotwire Turbo Streams effectively?

Redirects vs Turbo Streams.

Have you ever wondered which approach to take?

Should you always redirect? Or should you always use Turbo Streams?

Take a look at the following functionality. It moves tasks between tables representing states in a Kanban board.

demo of kanban example

The two approaches that can be used to implement this functionality are the Redirect approach and the Turbo Streams approach.

Let’s take a look at the redirect approach first.

For developers, it is easy, testable, and last but not least, productive. These are solid advantages that make it very tempting to use. And I don’t think it’s a bad idea to use it in some cases. I’ll say even…

RubySec 

CVE-2024-37031 (activeadmin): activeadmin vulnerable to stored persistent cross-site scripting (XSS) in dynamic form legends

### Impact Users settings their active admin form legends dynamically may be vulnerable to stored XSS, as long as its value can be injected directly by a malicious user. For example: * A public web application allows users to create entities with arbitrary names. * Active Admin is used to administrate these entities through a private backend. * The form to edit these entities in the private backend has the following shape (note the dynamic `name` value dependent on an attribute of the `resource`): ```ruby form do |f| f.inputs name: resource.name do f.input :name f.input :description end f.actions end ``` Then a malicious user could create an entity…
Ruby Rogues 

Ruby Reactivity: Navigating Front-end Solutions and Innovations - RUBY 638

  • In this episode, they dive into a wide range of topics related to application development and the choices developers face when it comes to using third-party libraries, building from scratch, and evaluating the trade-offs involved. They share their insights on showcasing skills through public projects, the development of their Rails and Hotwire book, and the importance of building everything from scratch instead of relying on third-party gems. Moreover, they share their experiences using Vite Ruby and Vite Rails gems, as well as their frustrations with the stimulus documentation.
    Throughout the episode, the conversation touches on vital elements of application development, from security…
Stanko Krtalic Rusendic 

Software is made by people

The recent Hotwire pop-up drama has shown me that some have forgotten that software is made by people - people with different backgrounds, different values, different skills, and different flaws.

The diversity in opinions and aproaches is what makes modern day software development great. That’s what drives innovation.

There are many tribes of people that like to build software in a certain way, that like to use a certain language, that approach problems a certain way, that prefere certan conventions over others. It’s easy to find a tribe and join it, or to start your own.

When I started programming professionally I’ve aleardy found my tribes and thought that people in other tribes - especia…
Drifting Ruby Screencasts 

Hotwire Combobox

In this episode, we tackle the issue of slow-loading dropdowns with a high volume of options by implementing an asynchronous select using the Hotwire Combobox library.
Island94.org 

Recently, June, 2024

  • I finished reading the Poppy Wars trilogy. It got tiresome by the end. I liked Babel much more, and I’m probably reading Yellowface next. I also read Exit Interview, which was another thrilling entry to the canon of “fantastically brilliant not-men who work in tech for whom it really should go better but unfortunately and predictably doesn’t”.
  • We saw “Film is dead. Long live film!” at the Roxie. It was enjoyable, reminded me of my big-Cable-Access-TV-energy days, and also gave far too little screen time to hearing from the film collectors wives (yes, exactly) and children. I thought this was my first movie theater since Covid, but Angelina reminded me we saw the Barbie Movie in a…
  • I played Animal Well…
GarrettDimon.com Posts 

Rails Generator Cheat Sheets

Long-form prose can only go so far, and even perfect prose isn’t easy to reference after reading it. So with Frictionless Generators, I wanted to think about how people would be building generators after reading the book. I ended up creating a set of cheat sheets for after-the-fact help and reminders.

Hotwire Weekly 

Week 22 - Reusing pages in Turbo Frame flows, and more!

Hotwire Weekly Logo

Welcome to Hotwire Weekly!

Welcome to the another issue of Hotwire Weekly! This edition covers the latest Hotwire articles, videos, and releases.

Happy reading! 🚀✨

📚 Articles, Tutorials, and Videos

Hotwire Comments with Ruby on Rails - Andy Leverenz published a blog post and video about building a comment system using Rails, Rails UI, and Turbo. He also announces a new Hotwire course.

How to reuse the same page in different Turbo Frame flows - Radan Skorić wrote about how to reuse pages in different Turbo Frame flows.

Customize the Turbo Progress Bar - Rails Designer published a blog post on how you can customize the Turbo Progress bar using CSS and Tailwind.

Teaser for new state…

Write Software, Well 

My Notes from Shape Up: Shipping Work that Matters

My Notes from Shape Up: Shipping Work that Matters

This book is a guide to how 37signals (creators of Basecamp and HEY) does product development. It’s also a toolbox full of techniques that you can apply in your own way to your own process and projects.

What I most like from the book is the fact that it's not written by some project management consultants or architecture astronauts, but real practitioners who've consistently shipped successful software (both commercial and technical) over the past two decades and have built real businesses. Like Ruby on Rails, a web framework derived from the real, working applications, Shape Up is distilled from the real project management practices that 37signals have used over many years.

I first read…

Notes to self 

Automating PostgreSQL backups to Digital Ocean Spaces with Kamal

Here’s a short tutorial on how I set up automated PostgreSQL backups to a DO Spaces bucket with Kamal.

PostgreSQL backups

If you are like me, you found yourself deploying PostgreSQL databases to Digital Ocean droplets with the new Kamal deployment tool. However, getting the database up and running is a job half-done. We need backups.

Since we are on Digital Ocean, we might as well utilize Digital Ocean Spaces, an S3-compatible object storage. That also means we can usually use any S3 tooling to do the job.

In my case, I depend on eeshugerman/postgres-backup Docker image which can do the heavy lifting using pg_dump under the hood.

Digital Ocean Spaces

Before diving into Kamal set up,…

Everyday Rails 

Replacing system tests with unit tests

Is your testing strategy too top-heavy? Here are some techniques to spread coverage down the testing pyramid.
GarrettDimon.com Posts 

Rails Generator Parent Classes

What are the differences between Rails::Generators::Base and Rails::Generators::NamedBase? When would we want to use one over the other and why?

GarrettDimon.com Posts 

ERb, Whitespace, and Indentation in Rails Generator Templates

When creating templates for custom generators, whitespace matters, so it’s helpful to know and understand the tools and tactics available to help us get it right. We can use whitespace-eliminating delimiters from ERb, generator helper methods, and built-in indentation helpers.

GarrettDimon.com Posts 

Create Generators that People Will Use

Creating a generator is one thing, but creating a generator that actually gets used is another. We’ll look at some of the ways we can make sure we’re building generators that the whole team uses.

GarrettDimon.com Posts 

Rails Generator Parent Classes

What are the differences between Rails::Generators::Base and Rails::Generators::NamedBase? When would we want to use one over the other and why?

Alchemists: Articles 

Site Updates

Cover
Site Updates

This is one of those rare — and eventually disappearing articles — to announce a few site updates. Enjoy! 🎉

Ruby Fusion

Cover

I’ve been posting about this gathering on Mastodon and made a few posts on Ruby Flow as well. If you love Ruby — especially advanced Ruby — and want to gather virtually, then definitely register! Our next gathering is on June 6th at 6:30pm MDT.

💡 For asynchronous chat, join our Twist discussions.

Project Feeds

Cover

I’ve been hard at work on the Milestoner project/gem while gearing up for an upcoming major release that will allow you to generate syndicated feeds for any project (private or public). To demonstrate, I’ve folded this…

Planet Argon Blog 

"We Need This Done in a Hurry!" How to Prepare for a Rushed Project

"We Need This Done in a Hurry!" How to Prepare for a Rushed Project

Project management processes work well... until there's an urgent issue that requires quick thinking and fast solutions. How can you and your team plan ahead for emergency situations and tackle them without creating an even bigger problem?

Continue Reading

Ruby on Rails 

Propshaft default for Rails 8, Guides updates, transaction.active_record events, and more!

Hi, it’s zzak. Let’s explore this week’s changes in the Rails codebase.

Rails World 2024 speaker lineup announced!
As well as another small run of tickets going live on June 4 at 2pm ET!

The Rails Foundation documentation team has also submitted two Rails guides for community review. If you have feedback, please submit it here: Action View Form Helpers Guide and the Active Record Migrations Guide.

Change asset pipeline default to Propshaft in Rails 8
Sprockets has served us well, but it’s time to hand over the torch to Propshaft in Rails 8.

Add a Rails Guide called “Tuning Performance for Deployment”
This guide explains major concurrency and performance principles for Puma and CRuby.

P…

Remote Ruby 

RailsConf 2024 Recap with the GoRails crew

In this episode of Remote Ruby, host Chris is joined by guests Kent Crutchfield and
Collin Jilbert, sharing their experiences and reflections from the recent RailsConf in
Detroit, MI. They discuss various aspects of the conference, including the engaging
talks, the announcement of RailsConf&#39;s impending conclusion in favor of focusing on
RubyConf and regional events, and their personal interactions with other attendees. The
episode highlights how RailsConf facilitated meaningful community interactions,
supported professional growth through the Scholars and Guides Program, provided
insights into the practical applications and potential of Ruby on Rails technology,
acknowledgements of the hard…

Saeloun Blog 

ActiveRecord::Relation#order Adds Support For Hash Values In Rails 7.2.

ActiveRecord::Relation#order is used to specify the order in which records should be retrieved from the database.

Recently in Rails 7.2 ActiveRecord::Relation#order added support for hash values.

ActiveRecord::Relation can take a hash where keys are table name, value is a hash of key (column name) and value (order direction). For example:

Client.includes(:projects).order(projects: { created_at: :desc })

Let’s see some examples with the Client and Project models.

class Client < ApplicationRecord
  # id, name, description

  has_many :projects
end

class Project < ApplicationRecord
  # id, name, price, client_id

  belongs_to :client
end

Before

Before 7.2, we were able to order…

Nithin Bekal 

A decade of vim

Almost exactly 10 years ago, I started using vim as my main text editor. I wrote a version of this article when I’d been using Vim for a year, so it was fun to look back at how I used it back then.

Evolution over 10 years

Thinking back to 2014, a lot has changed about how I use vim, most notably the fact that I technically don’t use vim anymore, because I use neovim! 😉

Neovim

Almost 7 years ago, I replaced vim with neovim, and have never looked back. It’s faster, has better defaults and has excellent LSP support. It is backwards compatible with vim, so I was able to switch to it without changing a single line of my .vimrc and then slowly migrated to neovim-specific config.

Lua for…

Awesome Ruby Newsletter 

💎 Issue 419 - Do I not like Ruby anymore?

Rails Designer 

Lesser Known Rails Helpers to Write Cleaner View Code

Rails (or more precise ActiveSupport and ActionView) has some really great, quality-of-life helpers so that your code is cleaner. I want to highlight a few that I don’t see used often, but will be great to add to your tool set.

These will highlight only helpers that are focused on code for the view-layer. If you purchased Rails Designer you might recognize most of these. 💡

This will be a swift article, covering all helpers in rapid succession.

class_names

The one helper I use. All. The. Time. It’s actually an alias for token_list.

I wrote an entire article about this snippet—so do check that out—but in essence it works like this:

class_names("item", { active: item.for_sale?, "out-of-s…

current_path?

RubyGems Blog 

Bundler Auto-Install Just Got A Whole Lot Better

The RubyGems Team is happy to share this post from our colleague Ngan Pham, Principle Software Engineer @ Gusto. Thank you, Ngan!

Working in a large monolith with many engineers, you never fail to get a flurry of changes everytime you pull from main. Then you have the typical ritual of running bundle install and, if you’re on a Rails application, rails db:prepare. Sometimes, you forget to run bundle install and get this message:

Could not find X-1.2.3 in locally installed gems
Run `bundle install` to install missing gems.

As of Bundler 2.5.10, you can now enable the auto_install config to have Bundler automatically install your bundle on demand. Simply set it in your project (or…

bu…
ruby – Bibliographic Wilderness 

Run your Rails gem CI on rails main branch

attr_json is basically an ActiveRecord extension. It works with multiple versions of Rails, so definitely runs CI on each version it supports.

But a while ago on attr_json, i set up CI to run on Rails main unreleased branch. I already was using appraisal to test under multiple Rails versions.

(which I recommend; sure it seems easy enough to do this ‘manually’ with conditionals in your Gemspec or separate Gemfiles and BUNDLE_GEMFILE — but as soon as you start needing things like different extra dependencies (version of rspec-rails anyone?) for different Rails versions… stop reinventing the wheel, appraisal just works).

So I added one more appraisal block for rails-edge, pretty…

Saeloun Blog 

PostgreSQL Adapter Now Decodes Columns Of Type Date To Date Instead Of String In Rails 7.2.

When working with Rails and PostgreSQL, we might encounter an issue where date columns are decoded as strings instead of Date objects.

The PostgreSQL adapter in Rails handles typecasting, but it falls short in parsing dates into Ruby Date objects, unlike the Mysql2 adapter which adeptly performs this task.

When direct SQL queries are used, the adapter doesn’t typecast date columns properly, so they are decoded as strings.

But with the recent changes in Rails 7.2, PostgreSQL Adapter now decodes columns of type date to Date instead of String.

Before

ActiveRecord::Base.connection.select_value("select '2024-01-01'::date").class

#=> String

In Rails, when using ActiveRecord::Base.connecti…

Ruby Weekly 

DHH on SQLite

#​705 — May 30, 2024

Read on the Web

Ruby Weekly

The Gemfile of Dreams Returns for 2024 — First published almost 18 months ago, this article distilling several developers’ experiences into a curated selection of useful libraries to consider when building modern Rails apps has had a major update for 2024.

Evil Martians

Ruby 3.3.2 Released — It’s the latest version, but there aren’t any new features. It’s a bug-fix release to fix, admittedly, quite a lot of minor nits including being able to crash Ruby with a rather odd string-related incantation.

Takashi Kokubun

Prod Alerts? You Should Be…

Ruby News 

Ruby 3.3.2 Released

Ruby 3.3.2 has been released.

This release includes many bug-fixes. See the GitHub releases for further details.

Download

RubySec 

CVE-2024-32978 (kaminari): Insecure File Permissions vulnerability in kaminari

kaminari versions prior to 0.16.2 are vulnerable to an Insecure File Permissions vulnerability, where certain files within the kaminari gem have insecure file permissions. Versions Affected: < 0.16.2 Fixed Versions: >= 0.16.2 # Impact An attacker with local access could write arbitrary code to the affected files resulting in arbitrary code execution. # Releases The fixed releases are available at the normal locations. # Workarounds Manually set the permissions of the affected files to `644`. ## All Affected Versions: ``` lib/kaminari/models/page_scope_methods.rb ``` ## Version 0.15.0 and 0.15.1: ``` spec/models/mongo_mapper/mongo_mapper_spec.rb ``` ## Version…
RubySec 

CVE-2024-35231 (rack-contrib): Denial of Service in rack-contrib via "profiler_runs" parameter

rack-contrib prior to version 2.5.0 is vulnerable to a Denial of Service via the `profiler_runs` HTTP request parameter. Versions Affected: < 2.5.0 Fixed Versions: >= 2.5.0 # Impact An attacker can trigger a Denial of Service by sending an HTTP request with an overly large `profiler_runs` parameter. ```shell curl "http://127.0.0.1:9292/?profiler_runs=9999999999&profile=process_time" ``` # Releases The fixed releases are available at the normal locations. # Workarounds There are no feasible workarounds for this issue.
Ruby News 

Datadog provides OSS community support for ruby-lang.org

We are excited to announce that Ruby’s official website, ruby-lang.org, has adopted Datadog for monitoring by Datadog OSS community support.

This allows us to effectively monitor the performance and availability of the site in real time for Ruby users. This key benefits of using Datadog include the following.

CDN Visibility

cache.ruby-lang.org provided by Fastly is most important infrastructure of Ruby ecosystem. Datadog enables monitoring of Content Delivery Network (CDN) performance. It tracks cache coverage, error rate, enhancing user experiences.

Unified Data Visualization

We have various web services for ruby-lang.org. Datadog allows to visualize log analytics data alongside…

Blogs on Noel Rappin Writes Here 

Better Know A Ruby Thing: Methods and Access Control (part 1)

I’ll be honest, I picked this topic out of the half-dozen or so Better Know A Ruby Things on my to-do list strictly because it’s maybe the only Ruby take that I genuinely argue with people about. To be even more honest, it got away from me a bit as I started writing the argument: which is why I tend to avoid declaring methods private.

I know these newsletters have tended toward long, but 3100+ words was a bit much even for me, so I’ve split it in half. Today, we’re covering methods, method definition, and access control in Ruby. The bit about private methods will be coming a a few days.


Time for the commercial:

Ruby on Rails 

Rails 7.2 Beta 1: Better production defaults, Dev containers, new guides design, and more!

The train for the Rails 7.2 release is leaving the station and we’re excited to announce the first beta release of Rails 7.2! There has been close to 2,500 commits made by over 400 contributors since Rails 7.1, so this release is packed with new features and improvements.

Please help us test all this new stuff, so we can ensure a solid final release of Rails 7.2.

Better production defaults

Rails 7.2 comes with better productions defaults to help you build more efficient applications.

Starting with YJIT. YJIT is Ruby’s JIT compiler that is available in CRuby since Ruby 3.1. It can provide significant performance improvements for Rails applications, offering 15-25% latency improvements.