Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Rails at Scale 

Autotuner: How to Speed Up Your Rails App

This article was adapted from my Rails World talk “Rails and the Ruby Garbage Collector: How to Speed Up Your Rails App”.

Ruby’s garbage collector is designed to be adaptable, scaling from short Ruby scripts to running apps that serve millions of requests per second. While it’s designed to be adaptable, it may not work optimally for every use case. For this reason, Ruby’s garbage collector supports many (19 at the time of writing) parameters that can be used to tune it. However, the use of these parameters requires knowledge of how the garbage collector works on the inside. It also doesn’t help that there are changes to the garbage collector in every major Ruby release, meaning that…

Peter Zhu 

Autotuner: How to Speed Up Your Rails App

Ruby's garbage collector is designed to be adaptable, scaling from short Ruby scripts to running apps that serve millions of requests per second. While it's designed to be adaptable, it may not work optimally for every use case. For this reason, Ruby's garbage collector supports many parameters that can be used to tune it. However, the use of these parameters requires knowledge into how the garbage collector works on the inside. Learn how the Autotuner gem can analyze your app's traffic and provide suggestions for tuning the garbage collector.
Saeloun Blog 

Enhancing Rails Log Output with SQL Query Count

Rails developers often faced challenges optimizing performance due to logs that lacked detailed SQL query information.

This made it difficult to identify specific performance bottlenecks, as the logs only provided general data on database interactions and view rendering times.

A recent update to the Rails framework, offers an insightful enhancement to how Rails logs SQL queries during template rendering.

This feature is particularly useful for developers who need to monitor SQL queries to optimize performance and debug issues efficiently.

Before

Prior to the implementation of this feature, Rails logs displayed basic metrics about the requests processed, including total time, view…

The Ruby on Rails Podcast 

Episode 514: Rails Camp! With Bobbilee Hartman

There are so many Ruby events happening recently, that it can be hard to know which one to go to. Today we’re going to talk about a rather unique event in the Ruby community. What if you could go to an event that was just the Hallway Track? And that event happened at a summer camp?

Show Notes
Rails Camp West Website - https://west.railscamp.us
Big Nerd Ranch - https://bignerdranch.com/

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 monitoring tools…

The Ruby Dispatch 

Fly.io ❤️ Kamal

If you love somebody, let them go, for if they return, they were always yours . If they don’t, they never were.

I’ve been scouting out what it will take to update Agile Web Development with Rails 7 for Rails 8, and chapter 17 (Deployment and Production) will need be rewritten to focus on Kamal. This naturally lead me to spend a few hours deploying my Showcase Rails app to Hetzner. Up to this point, I had been following the Kamal project closely, but never had actually used it.

Overall, I will say that if I didn’t have Fly.io available to me I would be inclined to use Kamal. Actually, I’ll go a bit further: I will continue to use it - I’ll maintain a server that serves primarily as a…

Evil Martians 

Next-level docs with Next.js: Teleport’s new customer acquisition channel

Authors: Olga Rusakova, Head of Communications, Alexey Ivanov, Sr. Frontend Engineer, and Travis Turner, Tech EditorTopics: Case Study, Frontend Development, Next.js

Well-structured, detailed documentation matters for all open source projects, but for Open Core solutions adopted by large businesses—it’s absolutely critical. See how we helped Teleport not only redesign their docs, but gain a super user acquisition channel in the process.

Well-structured, detailed documentation matters for all open source projects, but for Open Core solutions adopted by large businesses—it’s absolutely critical. Our customer project with Teleport where we totally redesigned their documentation platform is a…

Ruby Magic by AppSignal 

Should You Use Ruby on Rails or Hanami?

Ruby on Rails is the most popular web framework in the Ruby ecosystem and has a large user base, ranging from freelancers to large established companies. With an active user community and wide-ranging documentation, it can be used to build everything from simple applications to complex web platforms.

That said, a new contestant is taking on Rails’ dominance for the full-stack Ruby framework title: Hanami. It is a fast, modular Ruby framework with improved performance and maintainability compared to Rails.

In this article, we'll explore the strengths and weaknesses of each framework in terms of performance, features, testing, and more. So whether you are looking to build a customer-facing…

Ruby on Rails 

Rails World tickets releasing on April 30

Hi all,

Amanda here from the Rails Foundation. We have a quick update about Rails World 2024 tickets.

Tickets will be available beginning Tuesday April 30 at 1pm EDT.

General admission tickets are $559 USD. (This year we will not be issuing Early Bird tickets.)

Good to know: To mitigate any potential rush for tickets, all speakers have been informed if they are invited to speak, and all sponsor and Rails Foundation member tickets have been set aside. We are hoping that this reduces the amount of people looking for a ticket at the same time, so if your company is sponsoring Rails World or is a member of the Rails Foundation, please ask internally for the booking process.

If there are…

Josh Software 

A Developer’s Tale: Conquering CORS in .NET

As developers, we often encounter hurdles that test our resilience and technical acumen. In this blog post,  I shall share my experience navigating through two prevalent challenges in modern web development: Cross-Origin Resource Sharing (CORS) issues in .NET and prop drilling in ReactJS. My journey through these obstacles not only honed my problem-solving skills but … Continue reading A Developer’s Tale: Conquering CORS in .NET
Write Software, Well 

I am Available as a Freelance Developer

I am Available as a Freelance Developer

So this might come as a news to some of you, but I left my full-time job near the end of 2023.

Part of the reason was to focus on a few personal projects, but another reason was to dabble in freelancing. As a result, since the start of this year, I've been working as an independent software developer, working with Ruby and Rails.

So far, I've worked on three freelance development projects with one American and two Canadian clients, have successfully wrapped up two, and close to finishing the last one. I have probably written more Ruby in last few months than I did in the last year.

I am Available as a Freelance Developer

I had never worked as a freelancer before this experiment, but I am enjoying it so far, and the more…

Radan Skorić's personal site 

Not understanding the motivation behind best practices dooms you to misuse them

The point Best practices earn their name by being used with success by many people in many different situations. Over many attempts, on average, they worked better than other practices. Hence the name. Someone tries something. It works great. They tell others. They try it and for most of them it again works great. Good, we have a new best practice, the industry moves forward. Usually. Someti...
code.dblock.org | tech blog 

Adding eslint and Auto-Fixing an Existing TypeScript Project

In opensearch-api-specification#260 I added eslint, but had a hard time finding a cookbook for auto-fixing specific violations. Here it is.

First, I followed the getting started with eslint guide, which essentially tells you to run npm init @eslint/config@latest.

Rewrite eslint.config.mjs using the newer flat configuration format, making sure that the ignores and rules section appears last, as it will overwrite the defaults. For my TypeScript project, see the complete file here.

export default [
  pluginJs.configs.recommended,
  ...compat.extends('standard-with-typescript'),
  {
    files: ['**/*.{js,ts}'],
    ignores: [
      ...
    ],
    rules: {
      ...
    }
  }
]

Add the…

Ruby News 

CVE-2024-27282: Arbitrary memory address read vulnerability with Regex search

We have released the Ruby version 3.0.7, 3.1.5, 3.2.4 and 3.3.1 that have a security fix for an arbitrary memory address read vulnerability in Regex search. This vulnerability has been assigned the CVE identifier CVE-2024-27282.

Details

An issue was discovered in Ruby 3.x through 3.3.0.

If attacker-supplied data is provided to the Ruby regex compiler, it is possible to extract arbitrary heap data relative to the start of the text, including pointers and sensitive strings.

Recommended action

We recommend to update the Ruby to version 3.3.1 or later. In order to ensure compatibility with older Ruby series, you may update as follows instead:

  • For Ruby 3.0 users: Update to 3.0.7
  • For…
Ruby News 

Ruby 3.0.7 Released

Ruby 3.0.7 has been released.

This release includes security fixes. Please check the topics below for details.

See the GitHub releases for further details.

After this release, Ruby 3.0 reaches EOL. In other words, this is expected to be the last release of Ruby 3.0 series. We will not release Ruby 3.0.8 even if a security vulnerability is found (but could release if a severe regression is found). We recommend all Ruby 3.0 users to start migration to Ruby 3.3, 3.2, or 3.1 immediately.

Ruby News 

Ruby 3.1.5 Released

Ruby 3.1.5 has been released.

This release includes security fixes. Please check the topics below for details.

See the GitHub releases for further details.

Download

Ruby News 

Ruby 3.2.4 Released

Ruby 3.2.4 has been released.

This release includes security fixes. Please check the topics below for details.

See the GitHub releases for further details.

Download

Ruby News 

Ruby 3.3.1 Released

Ruby 3.3.1 has been released.

This release includes security fixes. Please check the topics below for details.

See the GitHub releases for further details.

Download

Ruby on Rails 

makandra joins the Rails Foundation

As we close the books on a busy Q1, the Rails Foundation is happy to welcome our newest Contributing member: makandra.

As the first German company to join the foundation, makandra brings with it over 15 years of building on Rails for large corporations such as Volkswagen and Audi to one-man companies such as Wissensbox.

Joining the Rails Foundation is a huge milestone for us and shows that we are fully behind Ruby on Rails. We are proud to be part of this community and we are determined to do our part to further develop and strengthen the framework.

Thomas Eisenbarth, makandra CEO and Founder

makandra has already spent years supporting the maintenance of the Rails ecosystem through…

Honeybadger Developer Blog (Ruby Articles) 

Shipping Rails logs with Kamal and Vector

The ability to record and see everything happening across your web applications is essential when building resilient and highly available systems. All of your events—from application logs to errors to user behavior—contain data that could be useful to you and your team. When you have a central place to access all this information, finding issues and their root causes becomes easier because you have the data at your fingertips. At Honeybadger, we're making that easier for everyone with our new observability platform, Honeybadger Insights. While you can send many things to Insights, logging is one of the quickest wins with the most gain.

In this tutorial, we'll deploy a Rails application to…

Short Ruby Newsletter 

Short Ruby News - Edition #87

A Monday summary of the articles, discussions, and news from the Ruby community
Gusto Engineering - Medium 

Exploring Early Career — Part 2: Navigating a Relationship With Your Manager

Exploring Early Career — Part 2: Navigating a Relationship With Your Manager

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…

Evil Martians 

How to manifest streamlined authentication: AWS Cognito in a React app

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

Streamline the authentication process and essentially alleviate the burden of managing it by integrating AWS Cognito and AWS Amplify into your React TypeScript application, with a focus on SAML 2.0 integration with Identity Providers and enhancing REST API security using Bearer token authentication.

Tired of the complexities and time-consuming tasks involved in implementing authentication in your React TypeScript application? What if there was a way to simplify the process?

Mike Perham 

Redis Licensing Changes and You

A few weeks ago, the owners of Redis changed its licensing from BSD to a more limited source available license. As far as I know this was done in order to prevent service providers from adding their own closed source, proprietary changes to their Redis service offerings. In principle I like this change. My Faktory project uses the AGPL license for the same purpose: Faktory is open source and anyone who offers Faktory as a service with proprietary changes should have to open source those changes too.
Write Software, Well 

How to Route an Incoming URL to a Rack Application in Rails

How to Route an Incoming URL to a Rack Application in Rails

TL;DR: You can route an incoming HTTP request to a valid Rack endpoint using the following syntax:

match '/url', to: RackApp

# OR

mount RackApp, at: "/url"

# OR

mount RackApp => "/url"

Let's dig in to learn why, what, and how. This is what we'll learn in this post:


💡
This post won't make much sense if you don't know what Rack interface (or protocol) is, what problem it's designed to solve, and what a Rack-compliant application looks like. This post is a good starting point.
The Definitive Guide to Rack for…
Greg Molnar 

The dangers of single line regular expressions

The Neonify challenge on Hack The Box is a small Sinatra(a Ruby web framework) app, that generates a glowing text of the submitted value:

RichStone Input Output 

Integrate'n'Automate Solutions Hangout

Integrate'n'Automate Solutions Hangout

Automating things in your life can save you time and mental energy which are rare but crucial resources in a world distracted by phones and screens. Same for businesses, only that all time and mental energy saved also translate directly into dollars.

You know that. But you still end up doing that manual boring task once a day for 5 minutes which translate into 6 wasted days of your life over 5 years:

Integrate'n'Automate Solutions HangoutSourced from the epic: https://xkcd.com/1205/

Imagine a world where you could just get out there into the 2024+ Internet and automate it? Maybe chat with a robot and get a great solution for it?

Umm, actually, this is almost reality. The only unsurmountable thing that stands between you and your…

Posts on Kevin Murphy 

Another Ruby for All Podcast Guest Appearance

Ruby for All Podcast 🔗

I was a guest on episode 66 of the Ruby for All podcast. Julie and I are both on the RailsConf 2024 Program Committee. I joined Julie and Andrew to talk about RailsConf 2024 and what it’s been like being on the Program Committee.

From the episode description:

In this episode of ‘Ruby For All’, hosts Andrew and Julie welcome guest Kevin Murphy, Software Developer at Pubmark and member of the RailsConf program committee. The discussion kicks off with Andrew and Julie catching up, then transitions into an in-depth conversation about the RailsConf planning process. Kevin and Julie, the Speaker Liaison, share insights into the workings of the program committee, the selection…

Ruby Central 

April 2024 Newsletter

Hello! Welcome to the April newsletter. Read on for announcements from Ruby Central and a report of the OSS work we’ve done from the previous month.

In March, Ruby Central's open-source work was supported by Ruby Shield sponsor Shopify, AWS, the German Sovereign Tech Fund (STF), and Ruby Central memberships from 29 other companies, including Partner-level member Contributed Systems, the company behind Mike Perham’s Sidekiq. In total, we were supported by 173 members. Thanks to all of our members for making everything that we do possible. <3 

Ruby Central News

New Jobs Added to Ruby Central Job Board

  • Revela recently posted a few new opportunities! Check it out here.

Keep up with Ruby Central’s…

RubySec 

CVE-2024-32463 (phlex): Cross-site Scripting (XSS) possible due to improper sanitisation of `href` attributes on `` tags

### Summary There is a potential cross-site scripting (XSS) vulnerability that can be exploited via maliciously crafted user data. Our filter to detect and prevent the use of the `javascript:` URL scheme in the `href` attribute of an `` tag could be bypassed with tab `\t` or newline `\n` characters between the characters of the protocol, e.g. `java\tscript:`. ### Impact If you render an `` tag with an `href` attribute set to a user-provided link, that link could potentially execute JavaScript when clicked by another user. ```ruby a(href: user_profile) { "Profile" } ``` ### Mitigation The best way to mitigate this vulnerability is to update to one of the following versions: -…
Saeloun Blog 

A Quick Guide to Ruby's Time and DateTime Classes

Introduction

Ruby has three main classes for handling date and time: Date, Time, and DateTime. The DateTime class is a subclass of Date and is used to handle date, hour, minute, second, and offset. However, The Ruby documentation also recommends using the Time class instead of DateTime.

The DateTime class is still available in Ruby for backward compatibility, but developers are encouraged to use the Time class for new projects and to migrate existing code to use the Time class.

DateTime in Ruby

DateTime in Ruby is a class that can handle date, hour, minute, second, and offset. It is a subclass of the Date class. The DateTime class can be used to represent a specific point in time with a…

Write Software, Well 

From a Lorry Driver to Ruby on Rails Developer at 38

From a Lorry Driver to Ruby on Rails Developer at 38

Most traditional interviews are focused on celebrities or popular personalities. However, I am more interested in interviews with hidden gems, unknown figures doing solid work, folks overcoming challenges just to be on the same playground as everyone else.

Hence, I wanted to start featuring some of them on this blog, providing a platform for sharing their compelling stories and valuable lessons. While they may not be on the covers of major publications or appearing on popular podcasts, their stories, backgrounds and experiences are nonetheless fascinating and worthy of a read.

This post shares the story of Pedro David Garcia Lopez, who switched careers from being a Lorry driver to a Ruby on…

Ruby on Rails 

ActiveRecord::Base#pluck accepts hash values, devcontainers improvements and more!

Hey everyone, Happy Friday! I hope you get some time to unwind and relax going into the weekend 😎

Vipul here with the latest updates for This Week in Rails. Let’s dive in.

Allow ActiveRecord::Base#pluck to accept hash values
This change adds support for ActiveRecord::Base#pluck to accept hash values.

# Before
Post.joins(:comments).pluck("posts.id", "comments.id", "comments.body")

# After
Post.joins(:comments).pluck(posts: [:id], comments: [:id, :body])

The same applies to .pick, which is implemented using .pluck.

Fix child association loading in :n_plus_one_only mode
Strict loading in :n_plus_one_only mode is designed to prevent performance issues when deeply traversing…

Ruby Rogues 

Scaling and Shopify with Kir Shatrov - RUBY 633

Today’s guest Kir Shatrov is a production engineer on Shopify based in London, UK. Today, he and the panel are discussing capacity planning. Kir believes that capacity planning becomes a priority when your company starts losing money and your customers are suffering. When someone does get to the point of scaling their app, it’s important to look at the limitations of the hosting service. It is also important to remember that scaling is not a job that is ever completed.
Kir talks about his experience and time with Shopify and what types of changes have happened in the four years he’s been with the company. Kir explains that when Shopify was founded about 12 years ago, they were some of the…
code.dblock.org | tech blog 

Commenting on Pull Requests in GitHub Actions

The OpenSearch API specification is authored in OpenAPI and used to auto-generate OpenSearch language clients. I wanted to know how much of the API was described in it vs. the actual API implemented in the default distribution of OpenSearch that includes all plugins. To do so, I have exposed an iterator over REST handlers in OpenSearch core, and wrote a plugin that rendered a very minimal OpenAPI spec at runtime. All that was left was to compare the manually authored OpenAPI spec in opensearch-api-specification to the runtime one, added in opensearch-api-specification#179. The comparison workflow output a total and relative number of APIs described.

To surface this information in pull…

Mike Coutermarsh 

AstroVim slow on large files

If you're finding AstroVim is lagging on very large files, it is possible the source of the problem is vim-illuminate.

To determine if it is, run :TSDisable illuminate. Does it solve your problem?

Large file cutoff

If that solved your problem, you can disable illuminate for large files with the following config change.

nvim/lua/plugins/vim-illuminate.lua

return {
  "RRethy/vim-illuminate",
  event = "User AstroFile",
  opts = function()
    return {
      large_file_cutoff = 3000,
    }
  end,
}

Now any file over 3000 lines will stop using illuminate.

💡
Note: I am using AstroVim 4 here.
Saeloun Blog 

A Quick Guide to Ruby's Time and DateTime Classes

Introduction

Ruby has three main classes for handling date and time: Date, Time, and DateTime. The DateTime class is a subclass of Date and is used to handle date, hour, minute, second, and offset. However, The Ruby documentation also recommends using the Time class instead of DateTime.

The DateTime class is still available in Ruby for backward compatibility, but developers are encouraged to use the Time class for new projects and to migrate existing code to use the Time class.

DateTime in Ruby

DateTime in Ruby is a class that can handle date, hour, minute, second, and offset. It is a subclass of the Date class. The DateTime class can be used to represent a specific point in time with a…

a-chacon 

authenticate_by: Prevent timing-based enumeration of users.

With the introduction of authenticate_by in Rails 7.1, we can now prevent enumeration attacks based on response times.
Awesome Ruby Newsletter 

💎 Issue 413 - RubyJS-Vite

Once a Maintainer 

Once a Maintainer: Armin Ronacher

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

This week we’re talking to Armin Ronacher, creator of the Flask framework and founder of the Pocoo team, a group of open source developers working on several widely used Python projects. Armin is a regular speaker at various developer conferences and currently works as a Principal Architect for Sentry.

Once a Maintainer is written by the team at Infield, a platform for managing open source dependency upgrades. Armin spoke with us from Austria.

How did you get into open source? Do you remember your first contribution?

Actually, it took me a lot longer to contribute than to write my own open source…

Ruby Weekly 

Making SQLite faster in Rails apps

#​699 — April 18, 2024

Read on the Web

Ruby Weekly

Prism in 2024 — Ruby 3.3 included a new standard library called Prism, a Ruby language parser that can be used internally by Ruby itself or as a library by your own code. It’s been a huge effort, and Kevin shares the full story of Ruby parsing (starting all the way back in 1994!) and how Prism is rapidly becoming a key part of the Ruby ecosystem.

Kevin Newton

Memetria: Secure, Scalable Redis Hosting — High performance Redis hosting with large key tracking, detailed metrics, and a superior uptime record.

Memetria sponsor

SQLite on Rails: The…

Rémi Mercier 

Delegated types in Rails: I tried them, and I’m not sure I really understood them.

Delegated types are a modelization pattern introduced in Rails in 2020 1. While researching this pattern for a feature, I found that existing articles overly focus on the theoretical comparison between delegated types, STI, and polymorphism. Examples used in these posts are often unrepresentative of the complexity of real-life applications.

Today, I want to share a real-world use case. I’ll walk you through my pre-existing domain architecture, the initial requirements, my mistakes, how I eventually used delegated types, what I learned, and my open questions.

This post is not your typical tutorial, so prepare for some detours. Hopefully, this post will help you better understand how…

Test Double 

How product management unlocks business value and maximizes ROI

Columbia Business School, The Kellogg School of Management and MIT all offer product management programs. There’s even a dedicated Product School and the Product Institute.

Companies from startups to enterprises are formalizing product management divisions – including Google, Mailchimp, Nextlix, Reddit and 1Password.

The role of Chief Product Officer is becoming increasingly prevalent, as evidenced by its adoption by seven out of the Top 10 companies on the Fortune 100 list.

Product management isn’t just a trend. It’s a powerhouse driving success across industries.

In fact, strong product management is critical to the success of software investments – both maximizing revenue…

RubyGems Blog 

The Implications of Crypto Rewards on RubyGems.org

Recently, at RubyGems.org, we’ve encountered an unusual surge of empty packages, triggering an investigation by our team. This influx of pointless gems, referencing one of the reasonably popular packages, hinted at an attempt to manipulate the tea.xyz protocol. As with any potentially risky incident, we delved deeper into the motives and mechanics behind these submissions. This short article contains our investigation, the conclusions we’ve reached, and how, theoretically, individuals looking to abuse the system can distort the idea of rewarding OSS contributions.

tea.xyz Trigger

The tea.xyz cryptocurrency creators claim that it came to life to enhance the sustainability of open-source…

RubySec 

GHSA-g7xq-xv8c-h98c (phlex): Cross-site Scripting (XSS) possible due to improper sanitisation of `href` attributes on `` tags

### Summary There is a potential cross-site scripting (XSS) vulnerability that can be exploited via maliciously crafted user data. Our filter to detect and prevent the use of the `javascript:` URL scheme in the `href` attribute of an `` tag could be bypassed with tab `\t` or newline `\n` characters between the characters of the protocol, e.g. `java\tscript:`. ### Impact If you render an `` tag with an `href` attribute set to a user-provided link, that link could potentially execute JavaScript when clicked by another user. ```ruby a(href: user_profile) { "Profile" } ``` ### Mitigation The best way to mitigate this vulnerability is to update to one of the following versions: -…
Greg Molnar 

The tale of an XSS in Phlex (CVE-2024-32463)

Phlex is a Ruby gem for building HTML components. Even though the HTML specification permits the usage of the javascript scheme in the href attribute of an anchor tag, Phlex doesn’t permit it to prevent an accidental XSS. When I had an initial look at the gem around its inception, I didn’t really checked how this filtering works, but a Twitter exchange with Joel reminded me to see if it can be bypassed somehow.

Ruby Magic by AppSignal 

Handling Exceptions in Grape for Ruby

Grape is a popular Ruby framework for building RESTful APIs. Exception handling plays a crucial role in ensuring the stability and reliability of any application, including those made with Grape.

This article will explore the basics of Grape exception handling, including customizing exceptions. We'll also touch on some best practices, and how to integrate your app with AppSignal for enhanced error monitoring and management.

Let's get started!

Basics of Grape Exception Handling

In this tutorial, we’ll see how to handle exceptions in a Grape API built in Rails. I have made a demo job board API for this, and you can check out the source code on GitHub.

Raising an Exception

You can raise an…

John Nunemaker 

Cushion vs Flow

Cushion vs Flow

Everything in money comes down to cushion vs flow.

Cushion is cash (or anything easily and quickly convertible to cash).

Flow is money in (and out).

To feel good/safe/whatever about your money situation, you need have a cushion large enough to cover your flow (for a good time period) and/or a healthy balance between inflow and outflow.

What's been striking me lately is the relationship between the two.

You can use cushion to create flow or you can use flow to create cushion.

Flow to Cushion

Not everyone has cushion, but everyone has flow. So let's run through some flow examples first.

Your flow is money in (income) and out (expenses).

  • $100k salary? That's flow.
  • Side hustle book making $1k/mo?…
Rails at Scale 

Prism in 2024

In Ruby 3.3.0, a new standard library was added to CRuby called Prism. Prism is a parser for the Ruby language, exposed as both a C library (optionally usable by CRuby) and a Ruby library (usable as a Ruby gem). The Prism project represents many person-years worth of effort, and is the result of a collaboration between Shopify, CRuby core contributors, other Ruby implementation authors, and Ruby tooling developers.

This post provides an overview of the Prism project — why it exists, where it stands today, and what the future holds. It also gives some insight into the broader ecosystem of Ruby parsers, intermediate representations, and tools. This includes some well-known projects that you…

Mike Coutermarsh 

How to use GitHub Copilot with AstroVim 4

This took me a while to figure out.

In this file: ~/.config/nvim/lua/community.lua

You need to add the following line.

{ import = "astrocommunity.completion.copilot-lua-cmp" },

Then, when you start nvim again. Run :Copilot auth. This will trigger the setup and you'll be good to go!

The Bike Shed 

423: Cognitive Strategies for Coders

Stephanie is back with a book recommendation: "Thinking in Systems" by Donella Meadows. This book has helped to bolster her understanding of complex systems in environmental, organizational, and software contexts, particularly through user interactions and system changes. Joël describes his transformative experience watching last week's total solar eclipse.

Together, they explore how systems thinking influences software development and team dynamics by delving into practical applications in writing and reading code, suggesting that understanding complex systems can aid developers in navigating and optimizing codebases and team interactions.

Transcript:

 JOËL: Hello and welcome…

Alchemists - Articles 

Ruby Heredocs

Document with Ruby gem
Ruby Heredocs

Ruby heredocs — or here documents — are a nice way to embed multiple lines of text as a separate document in your source code while preserving line breaks, indentation, and other forms of whitespace. This frees you up from having to concatenate multiple lines of strings which can get cumbersome.

Heredocs originate from UNIX as generally found in shell scripting. Heredocs are not specific to the Ruby language, though. Other languages incorporate some form of this syntax as well.

For the purposes of this article, we’ll explore the heredoc syntax in Ruby only.

Syntax

In general, heredoc syntax consists of several lines:

  1. A shovel operator (<<) to start the…

Short Ruby Newsletter 

Short Ruby News - Edition #86

The one with many discussions about code design in Ruby and Rails
GoRails Screencasts 

One Time Payments With Pay And Stripe

In this episode, we will learn about handling one-time payments with the Pay gem and Stripe embedded checkout. This is a great approach for non-recurring payments and can be implemented very quickly.
Greg Molnar 

Active Record transaction callbacks

Active Record introduced transaction callbacks recently. This change allows you to have a callback for the whole transaction, rather than to just have callbacks on a record’s after_commit event. To make this possible, ActiveRecord::Base.transaction yields a transaction object now and the callback can be registered on that:

Evil Martians 

CLI UX best practices: 3 patterns for improving progress displays

Authors: Roman Shamin, Head of Design, and Travis Turner, Tech EditorTopics: Design, CLI UX Design, Lean Software Development, Go, Rust

3 popular UI patterns for keeping users informed about ongoing processes: the spinner, the X of Y pattern, and the progress bar, the pros and cons of each, and tips for choosing the one that best suits your needs.

Enhance the way your CLIs report progress to users. While there are many developer experience improvements we could make to most command-line apps, I see this one as absolutely essential. If you are creating an app or a shell script for a terminal emulator and you're pressed for time but can only squeeze in one more improvement, make sure it is how…

Samuel Giddins 

Residency Update

Welcome to my thenth update as Ruby Central’s security engineer in residence, sponsored by AWS.

My goal is to write a short update every week, chronicling what I’ve been working on, and reminding myself that I was, in fact, productive.

This week I fixed some DoS vectors in RubyGems.org.

Documentation for the compact index

I spent a few hours helping Martin write down some authoritative documentation for the compact index API, which should help implementers of other RubyGems package repositories support the format, which comes with some big security benefits (largely, the ability to verify gem checksums on download & install).

Re-introducing avatars to RubyGems.org

I spent a few…

RubyGems Blog 

March 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 March.

RubyGems News

This month, RubyGems released RubyGems 3.5.7 and Bundler 2.5.7. These updates introduce a range of enhancements and bug fixes, all aimed at enhancing the developer experience. They include: the introduction of an attribute in Gem::SafeYAML.safe_load to control whether YAML aliases is enabled, a warning mechanism for when the required_ruby_version specification attribute is empty, and the removal of unnecessary configurations in the RuboCop setup…

Some other important accomplishments from the team this month include:

Making gem install respect the umask of the target…:

Posts on Kevin Murphy 

Making a (Sidekiq) Batch Recipe

The Right Number of Cooks in the Kitchen 🔗

Today we’re going to make a stew. The recipe has three steps that can all run independently. But when they’re done, their output needs to come together to finish the stew.

We’ll set each step up as a separate Sidekiq job. The details of each step aren’t important for this demonstration.

class GetRawVeggiesWorker  include Sidekiq::Job  def perform; endendclass GetBaconWorker  include Sidekiq::Job  def perform; endendclass GetCupOfSoupWorker  include Sidekiq::Job  def perform; endend

We can enqueue these to run by themselves no problem. However, we need to know when they’re all done so we can finish our recipe. We can group these together using a Sidekiq…

Ruby Central 

3 Day Flash Sale: RailsConf 2024

Because good things come in threes.

Surprise! It’s a 3-Day Flash Sale. RailsConf Detroit is just over three weeks away. We'll be in Detroit for three days from May 7 -9. So for three days only join us at a DISCOUNTED price before we sell out! Sale ends Monday.

Grab your discounted tickets HERE!

Ruby on Rails 

A week of fixes

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

Fix union select parentheses
When building UNION or UNION ALL queries involving LIMIT or ORDER BY, Arel generated invalid SQL previously. This pull request changes Arel::Visitors::ToSql so that SELECT statements in Union and UnionAll nodes are enclosed in parentheses to avoid syntax errors.

Fix copying virtual columns when altering a table in SQLite3
When Rails alters a SQLite table, it creates a new table and copies the structure and data from the old one.
The problem is that virtual columns are incorrectly copied (copied as classic columns). This pull request fixes that.

Fix ActiveJob::EnqueueAfterTransactionCommit
perform_later is supposed to return…

RubyGems Blog 

3.5.9 Released

RubyGems 3.5.9 includes enhancements.

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.9 as a default gem.

SHA256 Checksums:

  • rubygems-3.5.9.tgz
    2b203642191e6bb9ece19075f62275a88526319b124684c46667415dca4363f1
  • rubygems-3.5.9.zip
    e84246e89ddd8ac14844fc289e5c863346c67fdaa898c88a55438943397993b6
  • rubygems-update-3.5.9.gem
    4825e486c53db8885978f5892357fd7c2c8bebb39601d66e24e9c2fe1d891cbd
Write Software, Well 

How I Read Rails Source Code

How I Read Rails Source Code

After my previous post, How a Ruby Method Becomes a Rails Action, I got quite a few emails asking about the best way to read the Rails source code. Here's one from Peter, a long-time reader of the blog:

You have mentioned that you enjoy just reading the Rails source code. I am interested in going through the Rails source code but the code base is so large, I'm not quite sure where to start. Would you have a suggestion for someone like me, just learning Rails, to tackle this?

It just seems so overwhelming that I'm not quite sure where to start and how to proceed.

While I don't think there's one best way to read the Rails codebase, I've found a few techniques that are much more effective than…

Remote Ruby 

Irina Nazarova from Evil Martians

In today’s episode, Jason, Chris, and Andrew, along with their guest, Irina Nazarova, CEO of Evil Martians, engage in a candid discussion that covers the intricacies of using Rails and integrating it with technologies like React, and the challenges of marketing developer-facing products. The discussion also touches on open-core business models, the relevance of Docker in current tech companies, and the future of software deployment. Also, Irina touches on a new tool from Thoughtbot called Superglue, a new open source product called Skooma, and she invites listeners to come to RailsConf and some Ruby meetups in San Francisco coming soon. Press download to hear more!

Panelists:
Jason Charnes
Ch…

Giant Robots Smashing Into Other Giant Robots 

Upcoming Talks at Ruby Conferences in Spring and Summer 2024

Upcoming Conference Talks by thoughtbot

The year’s already gone by so fast; Since January 2024, thoughtbotters have already attended and presented talks at events like CCOSS and Sin City Ruby 2024.

Didn’t make it to these events? Don’t worry, we’ve got more amazing talks lined up for the spring and summer of 2024. Mark your calendars for these upcoming talks by thoughtbotters!

Tropical.RB: April 4-5

Tropical.RB brings together Rails developers from Latin America to talk about Rails and share knowledge.

The Fast Lane: Asynchronous Rails

Join Matheus, a senior developer at thoughtbot, at Tropical.RB on April 5, 2024, as we explore how to leverage…

Awesome Ruby Newsletter 

💎 Issue 412 - Let there be docs! A documentation-first approach to Rails API development

RubyGems Blog 

3.5.8 Released

RubyGems 3.5.8 includes security, 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.

## Security:

  • Respect global umask when writing regular files. Pull request #7518 by deivid-rodriguez

## Enhancements:

  • Allow string keys with gemrc. Pull request #7543 by hsbt
  • [Experimental] Add “gem rebuild” command. Pull request #4913 by duckinator
  • Installs bundler 2.5.8 as a default gem.

## Bug fixes:

  • Fix NoMethodError crash when building errors about corrupt package files. Pull request #7539 by jez
  • Fix resolver to properly intersect Arrays of Gem::Resolver::Activation objects.…

SHA256 Checksums:

  • rubygems-3.5.8.tgz
    6ddd48fc8c53ec303b24b7517a6102477463c9929…
Ruby Weekly 

Crystal in your Ruby

#​698 — April 11, 2024

Read on the Web

Ruby Weekly

CrystalRuby: Embed Crystal Code Directly in RubyCrystal is a Ruby inspired programming language that boasts a lot of great features and is well worth a try IMHO. One benefit is performance, and this gem lets you write Crystal code, inlined in Ruby, giving you a potential performance boost without a huge shift in syntax. New and YMMV!

Wouter Coppieters

🇯🇵  Matz on Static vs Dynamic TypingThis article is in Japanese, so get your browser’s translation feature ready. It’s a transcript of thoughts by Ruby’s creator (in a talk given in 2022) on the pros…

Ruby Rogues 

The Power of Turbo Native with Ayush Newatia - RUBY 632

Ayush Newatia is a Freelance Web Developer. They delve into the world of modern app development, Chuck and Ayush take us on a journey through the intricacies of utilizing Turbo Native and Hotwire in Rails applications. They share their insights on using native elements as the backbone of apps while incorporating web content, simplifying app development, and bridging the gap between web and native code with the help of Strata. With a focus on enhancing user experiences, they explore the benefits and challenges of native and hybrid apps, along with a deep dive into the features and requirements of Turbo Streams. Join them as they unravel the complexities and potential of modern web and app…
avdi.codes 

Goodbye Mastodon. Hello Fediverse.

As of today, this site is also my canonical social media presence!

Notes on making this happen:

I’m using the ActivityPub and Webfinger plugins to make WordPress users into full-fledged Fediverse citizens.

I had a lot of trouble getting Mastodon to recognize this site as a valid target for an account move. Mastodon demands some not-so-standardized stuff to appear on the target site that effectively makes its vaunted “account mobility” only work with other Mastodon instances 🧐

First off I had to disable caching for user profile pages. To be fair this part wasn’t a Mastodon issue. I’m going to come back around later and see if I can re-introduce caching more in content-type-aware…

Julia Evans 

Notes on git's error messages

While writing about Git, I’ve noticed that a lot of folks struggle with Git’s error messages. I’ve had many years to get used to these error messages so it took me a really long time to understand why folks were confused, but having thought about it much more, I’ve realized that:

  1. sometimes I actually am confused by the error messages, I’m just used to being confused
  2. I have a bunch of strategies for getting more information when the error message git gives me isn’t very informative

So in this post, I’m going to go through a bunch of Git’s error messages, list a few things that I think are confusing about them for each one, and talk about what I do when I’m confused by the message.

imp…

The Ruby on Rails Podcast 

Episode 513: Modern Rails Apps Ayush Newatia

Rails 7 and Hotwire have completely revolutionized server side Rails apps. Developers can now get much more reactivity with way less javascript, less tooling, and simpler deployments. You’ve probably heard a lot about Rails 7.1 and Hotwire. Maybe you’re even using it in production? Ayush Newatia joins the show to talk about his new book, The Rails and Howtire Codex.

Show Notes
Radioactive Toy - https://radioactivetoy.tech
Rails and Hotwire Codex - https://railsandhotwirecodex.com
Folly Ayush on Ruby Social - https://ruby.social/@ayush
Listen to Ayush on The Just A Spec Podcast - https://justaspec.show
Rails and Hotwire Codex Link https://railsandhotwirecodex.com/

Josh Software 

The Journey of an HTTP Request – From Client to the Server

Developers are known for working with HTTP requests. But have you ever wondered what happens in the background – when a button that performs an HTTP request is clicked to get a response from the server?  The journey of an HTTP request from the client’s side to the server comprises multiple stages. POV of the … Continue reading The Journey of an HTTP Request – From Client to the Server
RoRvsWild's blog 

Super Fast Rails – A promise given is a debt

Super Fast Rails List

The SuperFastRails joke

Before reading this one, you should read the previous article to understand fully.

If you don’t have a few extra minutes, here is a summary: I was describing a new revolutionary gem that could automatically optimize any Rails app. It could create missing indexes, remove unused indexes, optimize SQL queries, and handle dangerous migrations. All that without needing you to think about it.

That was of course an April fools’ joke. It worked pretty well, possibly too well:

Not going to consider you for a good long while until I get over the April 1st post. Boomed me good

A promise given is a debt. Now the joke is on you, my friend.

Sorry, that was quite a…

Giant Robots Smashing Into Other Giant Robots 

Introducing form_props: The power of Rails forms now available for React!

Miss the convenience of Rails when working in React? Tired of building React forms ever so slightly different from project to project? Prefer working with HTML over customizing the Rails form builder? Prefer HATEOAS? Boy, do I have the tool for you!

Introducing form_props, a new member of the React ❤️ Rails family, which includes props_template, humid, and superglue. It’s a fork of Rails’s own form_with, made to output HTML attributes instead of HTML so you can wield the power of Rails’s form in React, and even React Native!

How it works:

Within a jbuilder or props_template file: new.json.jbuilder or new.json.props

json.create_form do
  form_props(@post) do |f|
    f.text :title
    f.s…

Would output

{
  "createForm": {
    
Island94.org 

A comment on Second Systems

I recently left this comment on a Pragmatic Engineer review of Fred Brook’s Mythical Man Month in “What Changed in 50 Years of Computing: Part 2”. This was what I reacted to:

Software design and “the second-system effect”

Brooks covers an interesting phenomenon in Chapter 5: “The Second-System Effect.” He states that architects tend to design their first system well, but they over-engineer the second one, and carry this over-engineering habit on to future systems.

“This second system is the most dangerous system a [person] ever designs. When [they] do this and [their] third and later ones, [their] prior experiences will confirm each other as to the general characteristics of…

BigBinary Blog 

Automatically sentence-case i18next translations

We use i18next to handle our localizationrequirement. We have written in great detail how we usei18next and react-i18next librariesin our applications.

As our translations grew, we realized instead of adding every combination of thetexts as separate entries in the translation file, we can reuse most of them byutilizing the i18next interpolation feature.

Interpolation isone of the most used functionalities in i18n. It allows integrating dynamicvalues into our translations.

{  "key": "{{what}} is {{how}}"}
i18next.t("key", { what: "i18next", how: "great" });// -> "i18next is great"

Problem

As we started to use interpolation more and more, we started seeing lot of textwith irregular casing. For…

Test Double 

Work around Rails schema noise with one weird trick

If you’ve ever worked on a Rails project with a team, you’ve probably run into an issue with changes appearing in db/schema.rb. The Rails robots that make up Active Record do their best to be helpful by keeping your db/schema.rb file up to date. But while they’re doing that, they tend to inject a bunch of other unwanted changes.

Here’s an example from a project I’ve been working on:

@@ -102,7 +102,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_06_230921) do

   create_table "active_storage_attachments", force: :cascade do |t|
     t.bigint "blob_id", null: false
-    t.datetime "created_at", null: false
+    t.datetime "created_at", precision: nil, null: false

In this…

Evil Martians 

Let there be docs! A documentation-first approach to Rails API development

Authors: Svyatoslav Kryukov, Backend Engineer, and Travis Turner, Tech EditorTopics: Backend, Ruby on Rails, Ruby, Microservices

We examine approaches to API documentation, with a case for why the documentation-first approach is beneficial, plus, we'll not only introduce a new Ruby gem, Skooma, that will be a revelation for those who are ready to follow this path, you can also read on for practical tips and advice for jumping in.

In this post, we’ll examine approaches to API documentation, with a case for why the documentation-first approach is beneficial, plus, we’ll not only introduce a new Ruby gem that will be a revelation for those who are ready to follow this path, you can also read on…

Nithin Bekal 

Abstract methods and NotImplementedError in Ruby

Ruby’s NotImplementedError exception is often used as a placeholder in abstract classes for methods that should be implemented by subclasses. But did you know that this is not how this exception class was intended to be used?

How is it commonly (mis)used?

Let’s start with an example of a common usage pattern of NotImplementedError. We have a BaseSetting class, and we want to convey that anyone subclassing this should implement a to_html method.

class BaseSetting
  def to_html
    raise NotImplementedError
  end
end

class Text < BaseSetting
  def to_html
    "<input type='text'>"
  end
end

class Number < BaseSetting
  # Forgot to implement to_html
end

TextSetting.new.to_html   #=>…

In the above case, the Text setting class already implements to_html, If we’re introducing a new Number setting…

The Bike Shed 

422: Listener Topics Grab Bag

Joël conducted a thoughtbot mini-workshop on query plans, which Stephanie found highly effective due to its interactive format. They then discuss the broader value of interactive workshops over traditional talks for deeper learning.

Addressing listener questions, Stephanie and Joël explore the strategic use of if and else in programming for clearer code, the importance of thorough documentation in identifying bugs, and the use of Postgres' EXPLAIN ANALYZE, highlighting the need for environment-specific considerations in query optimization.

Notes to self 

How I wrote Kamal Handbook in 5 weeks and sold 300+ copies at the same time

I unexpectedly wrote a second book. And I unexpectedly sold 300 copies while making it.

Idea

The idea of Kamal Handbook came after spending more time deploying with the tool and seeing my Kamal blog post trending.

But the thing was I didn’t want to write another book. And in fact, the main selling point of Deployment from Scratch was that it didn’t focus an any particular deploy tool.

Kamal changed this perspective for two reasons. I genuinely liked the tool and I could be the first author to publish something on Kamal. I wouldn’t do it if such a book existed.

So I conviced myself that if I can do this in ~ 5 weeks, I should.

Writing

The biggest change from my last book was giving…

Honeybadger Developer Blog (Ruby Articles) 

Account-based subdomains in Rails

For many applications, access is usually through a single domain, such as yourapp.com. This way, the application developer is able to offer a unified experience to all users. This works great most of the time, but imagine a situation where you need to give each user a customized experience; how would you achieve this?

One of the ways you can customize the user experience in a single application is by using account-based subdomains. Instead of giving users a single entry point into your app, offer them customized subdomains: user1.exampleapp.com, user2.exampleapp.com, and so forth. With account-based subdomains, you essentially give users an individualized entry point where they can manage…

In…

Gusto Engineering - Medium 

Gusto’s Gradual Modularization Destination

When talking to developers about gradual modularization, one of the questions is, “So… where are we headed?” That is, what is the destination of a modularization journey? These developers all work in a large, monolithic codebase-the large application that backs much of Gusto’s functionality. Based on discussions with our peers at different organizations, we know there are a whole bunch of companies in similar situations. These companies all have one thing in common, we’re using Ruby and Rails as a significant part of their backend systems.

We believe there is a juncture that all of these companies should strive to move their packages towards. This realization is based on working on…

Saeloun Blog 

Rails 8 adds Rubocop by default to new applications

RuboCop is a static code analyzer also linter and code formatter for the Ruby programming language. It will enforce the guidelines outlined in the community Ruby Style Guide.

It helps developers in ensuring adherence to coding style standards, identifying potential code flaws, and enhancing the overall quality of the codebase. In addition to identifying code problems, RuboCop also automatically corrects those issues.

Developers can adjust rules defined by Rubocop to match project coding standards.

Before Rails 8.0

Before Rails 8 we had to manually integrate Rubocop gem to our project.

We can simply install it like below.

gem install rubocop

or we can add it to the gemfile of the…

Evil Martians 

MVPs, prototypes, results: how to win with a Martian Design Sprint

Authors: Roman Shamin, Head of Design, and Travis Turner, Tech EditorTopics: Design, Martian Design Sprint, Sprints to Solutions, Customer Journey Map, Figma

Our clients have seen big wins from our design sprints: rapid MVPs, design artifacts that set the project course, new investment funds, successful business pivots, and even design awards. This is the ideal way to kickstart the entire development process, bring founder ideas to life, and give Evil Martians a test drive.

Google originally introduced the Design Sprint methodology back in 2010. Since then, Evil Martians have customized that original framework to perfectly suit our clients’ needs. Today, the strength of the Martian Design…

Drifting Ruby Screencasts 

Windows and WSL

In this episode, we'll look at setting up a fresh Windows 11 environment for Ruby on Rails development. We'll be looking at a few different tricks that makes managing a Windows environment much easier.
Aha! Engineering Blog 

Using calculated attributes to help users surface delivery risks

img { max-height: 400px; margin-right: auto; margin-left: auto; } table, th, td { font-family: Red Hat Display, "Helvetica Neue", Arial, "Noto Sans", sans-serif; border: 1px solid var(--aha-gray-400); } th { background-color: var(--aha-gray-100); color: var(--aha-gray-900); text-align: left; } td img { margin: 0.5em auto !important; }
by Michel Shiel

Feature delivery can be impacted by many factors. Some are readily visible, but others are more nuanced — or buried in mountains of data.

What if we could show developers and project managers the factors that would affect feature delivery in real time? And what if that information…

Fullstack Ruby 

Using Lambdas and Callables for Deferred Evaluation, Control Flow, and New Language Patterns

Ruby blocks are simply amazing, and I’ve written about some of the cool things you can do with them.

But something which confused me early on as I learned Ruby and started using gems and frameworks was when to write a block vs. when to write an explicit proc or lambda.

For example, here’s some example code provided by Faraday, a popular HTTP client for Ruby:

conn = Faraday.new(url: 'http://httpbingo.org') do |builder|
  builder.request :authorization, 'Bearer', -> { MyAuthStorage.get_auth_token }
  # more code here...
end

As you can see, there are two different use of blocks/procs here. The first one is the one passed to Faraday.new — it yields builder so you can configure the request.…

Mike Coutermarsh 

How high scale Rails apps make schema changes

I recently wrote a post over on the PlanetScale blog sharing how we make schema changes for our own Rails app.

In the post I share a couple concepts that might be new to you.

  1. "Online" schema change tools
  2. Separating rails db:migrate from deploys

If your team or app is starting to grow and you're wondering what to look out for next. Give it a read, I hope you find it helpful.

RichStone Input Output 

Helping You to Succeed

Helping You to Succeed

Back in 2014, I was doing quite well. I played poker professionally, essentially living my dream. But my career had to stop abruptly for health and financial reasons.

I looked for a new dream and found coding. It went OK most of the time; I liked the nerdy aspect of it. But it also came with severe dips and challenges that seemed unsurmountable. I was on the brink of switching studies to something like art history because I had considerable trouble passing a course exercise. I also ran away from what seemed like an undoable challenge, e.g., giving a talk in front of a big audience or finishing a coding project that appeared to have lost its purpose.

What if there was a way to see the other…

RichStone Input Output 

Mentoring vs Coaching vs Teaching vs Consulting

Mentoring vs Coaching vs Teaching vs Consulting

"I will teach you to be rich!"

"Everyone is a coach nowadays!"

"I'm looking for mentorship in sorting my socks."

"I'm not your guru!"

"No, I'm not a freelancer, I'm a consultant."

There are so many terms trying to explain training and helping relationships between human beings. With many terms comes confusion and misuse. What if there was a committee that would decide about the proper usage of those terms? How many mentees would be saved from being coached? How many minutes of podcasts could be unwasted trying to figure out the right terms to use?

Wait no longer. And don't wait for a committee. You can have your own definition right now.

Below is my unscientific digest about the differences…

Write Software, Well 

How a Ruby Method Becomes a Rails Action: Part One (Metal)

How a Ruby Method Becomes a Rails Action: Part One (Metal)

As a Rails developer, you probably know what the following piece of code does.

# config/routes.rb

get "/about", to: "pages#about"


# controllers/pages_controller.rb

class PagesController < ApplicationController
  def about
    @title = "About Me"
  end
end

# views/pages/about.html.erb

<h1><%= @title %><h1>

As expected, it defines a route that directs a request to /about page to the PagesController#about method, which sets an instance variable @title that's displayed by the about.html.erb view.

Plain and simple.

Have you ever wondered how does an incoming HTTP request reaches the about method in the Rails controller? Like, who actually calls this method, what really happens before this…

Island94.org 

A Ruby Meetup and 3 Podcasts

Me standing on a small stage in front of a slide with 2 adoptable cats and the GitHub logo

Last week I spoke at the SF Bay Area Ruby Meetup, which was hosted at GitHub HQ, which made for an easy commute for me. Here’s the video and the slides. My talk was entitled “An OK compromise: Faster development by designing for the Rails autoloader”

Also, I haven’t shared here the 3 podcasts I did over the past few years. Here they are:




This post, A Ruby Meetup and 3 Podcasts, is published on Island94.org. Tweet me at @bensheldon to discuss it.

Mike Coutermarsh 

Using replicas to scale out your database

High traffic websites often use database replicas to scale out their reads. Most web traffic is a GET request anyway and never modifies data.

But how do you know when you should READ from the primary?

The answer is more complex than you might think. And it's important to understand the details.

Whenever data is updated on the primary, the change needs to be replicated to each of the replicas. The time this takes is known as “replication lag”.

Primary + 2 Replicas

You need to understand this concept to be able to work with replicas effectively.

Healthy replication lag is usually just a few milliseconds. But if you have a busy database, or are maybe running a schema change, it can grow to seconds…

Samuel Giddins 

Residency Update

Welcome to my ninth update as Ruby Central’s security engineer in residence, sponsored by AWS.

My goal is to write a short update every week, chronicling what I’ve been working on, and reminding myself that I was, in fact, productive.

This week I dealt with the fallout from the xz/liblzma backdoor. I also took a last minute trip to NY for a funeral, which was honestly more exhausting than firefighting the backdoor.

xz/liblzma backdoor

Thanks for ruining my Friday, Saturday, & Sunday, world. Like every other infosec professional, I spent several days chasing down the impact of the xz backdoor on RubyGems and the Ruby ecosystem writ large. The major product of those dozens of hours of…

Once a Maintainer 

Once a Maintainer: Jeremy Smith

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

This week we’re talking to Jeremy Smith, co-host of the IndieRails podcast, organizer of the BlueRidge Ruby conference, and enthusiastic member of the Ruby and Rails communities.

Once a Maintainer is written by the team at Infield, a platform that helps companies upgrade their open source software without breaking things.

How did you get into programming?

So I distinctly remember seeing my first website when I was a teenager, probably 1995-96, something like that. I had dial up access to my dad's university Internet service because he was getting his PhD, so he had it as part of his program. I…

Remote Ruby 

Code, Confessions, and Casinos - Sin City Ruby

In today’s episode, Jason, Chris, and Andrew kick things off sharing things from their
personal and professional lives, touching upon various themes such as the peculiarities
of working on Good Friday, the journey from late-night adventures to morning rituals,
and the complexities of parenting. The discussion also dives into programming topics,
such as issues with using Rails, Turbo, and Stimulus for web development, and
experiences with React components. They share personal stories about the Sin City
Ruby conference, including the challenges and highlights of Jason’s live coding during
his presentation, the dynamics of attending without a ticket, networking among
colleagues, and exploring casinos…

Ruby on Rails 

Deferring jobs enqueueing to after the transaction commit, queries count in rendering logs and more

Hi, Wojtek here exploring this week’s changes.

Rails World 2024 edition website is now live
With tickets going on sale in April.

Allow to register transaction callbacks outside of a record
ActiveRecord::Base.transaction now yields an ActiveRecord::Transaction object, which allows to register callbacks on it.

Article.transaction do |transaction|
  article.update(published: true)
  transaction.after_commit do
    PublishNotificationMailer.with(article: article).deliver_later
  end
end

Added ActiveRecord::Base.current_transaction which also allows to register callbacks on it.

Article.current_transaction.after_commit do
  PublishNotificationMailer.with(article: article).deliver_later
end

Awesome Ruby Newsletter 

💎 Issue 411 - The Ruby on Rails Resurgence

avdi.codes 

Hello, Fediverse

This is mainly a test post to verify that this blog is now on the Fediverse (via the ActivityPub plugin). Hi there, fedi-friends!

The post Hello, Fediverse first appeared on avdi.codes.

Ruby Rogues 

Navigating the Changing Tech Landscape with Fabio Akita - RUBY 631

Dive into an insightful conversation with Fabio Akita, a prominent figure in the tech industry with a successful YouTube channel dedicated to programming techniques and a thriving software development company in Brazil. Join us as we explore Fabio's journey in content creation, his experiences in the tech industry, and his valuable insights on navigating the ever-evolving landscape of programming. From discussing career decisions to the shift in the Ruby community, we uncover practical advice and thought-provoking perspectives that are sure to inspire and inform developers at all levels. Get ready for an engaging and enlightening discussion that delves into the true essence of the tech…
Ruby Weekly 

A profiler and a fuzz tester

#​697 — April 4, 2024

Read on the Web

Ruby Weekly

Vernier: A Next Generation CRuby (3.2+) Profiler — A sampling profiler that can track multiple threads, GVL activity, GC pauses, idle time, and more. If you’ve been enjoying Tenderlove’s recent livestreams, you may have ▶️ seen it on there. Once you’ve captured a profile, you can view it in a few ways (including on the web), but here’s some example output.

John Hawthorn

Need to Upgrade Rails with Zero Downtime? — Ready for Rails 7.2? Top-notch engineering teams (from startups to Fortune 500 companies) trust the FastRuby.io team in mission-critical…

Test Double 

4 lessons for high-quality software from a surprising place

High-risk industries have regulatory compliance for a reason. While regulatory requirements might feel like a painful or tedious process, they build guardrails that save time and money in the long run.

Because no one person should be in a position to cause an aircraft component to fail.

Prior to joining Test Double in 2023, I had spent nearly the entirety of my professional career working in regulated software industries. With a decade of experience in aerospace, I learned how to implement the stories and code that made up a product while always staying within the scope of the regulations.

As I’ve moved away from regulated software industries and into DevOps consulting, I keep…

Hanami 

New leadership for Hanami

After 17 years dedicated to open source Ruby, Luca Guidi has stepped down from the Hanami and dry-rb projects.

In Luca’s place, I will step up as Hanami project lead. I also remain a committed member of the dry-rb core team.

As for Hanami, we’re continuing on the path we’ve followed over the last few years. 2.1 is now out the door, and 2.2 is next. As we plan for this release, you can look forward to seeing updates on our forum.

I’d like to extend a heartfelt thank you to Luca for all his contributions to Hanami and Ruby. Collaborating with Luca has been a true pleasure for me, and I’m very proud of what we’ve been able to create together in Hanami 2. I’m looking forward to extending…

The RubyMine Blog : Intelligent Ruby and Rails IDE | The JetBrains Blog 

RubyMine 2024.1: Full Line Code Completion, New Terminal, Improved AI Assistant and VCS Support

RubyMine 2024.1 is now available!

At the heart of RubyMine 2024.1 lies its full line code completion feature, which is powered by a fully-integrated, advanced deep learning model. RubyMine 2024.1 also introduces support for the mise version manager, further streamlining the management of Ruby versions. This release includes improved AI Assistant and inspection updates tailored to Ruby 3.3.

Additionally, RubyMine 2024.1 enhances the development experience with features such as closing tags in ERB, the ability to run VCS commands with the current project’s SDK, and debase 3.0 support that is optimized for Ruby 3.3, enhancing debugging capabilities and ensuring seamless compatibility…

The RubyMine Blog : Intelligent Ruby and Rails IDE | The JetBrains Blog 

Full Line Code Completion in JetBrains IDEs: All You Need to Know

Programming with AI is still a highly divisive topic, but there’s no denying that more and more developers are starting to incorporate AI into their daily workflows. Whether you’ve already picked your side in the debate or are still undecided, we’ve got a new feature in v2024.1 of JetBrains IDEs that might just pique your interest – full line code completion. It’s AI-powered and runs locally without sending any data over the internet.

In this blog post, we’ll tell you more about what full line code completion is, how it works, what languages are supported, and how you can provide feedback about it to us.

What is full line code completion in JetBrains IDEs?

This new type of code…

AkitaOnRails.com 

Meu "Netflix Pessoal" com Docker Compose

Quem acompanhava meu canal no YouTube ou meu Instagram já acompanhou a saga com meu NAS (meu servidor pessoal), meu Synology DS1821+ com quase 80 TB de espaço.

Todos os videos do meu canal, incluindo os arquivos originais, estão lá. Só isso dá terabytes. Todo minha biblioteca do Steam está lá, são uns 4 terabytes. Todos os meus jogos antigos, retro-games, também, incluindo ISOs de Xbox 360 e PS3. São mais 4 terabytes. Toda minha coleção de discos Ultra HD (BluRay 4K) eu ripei (fiz backup), são mais alguns terabytes. Neste instante já estou usando mais de 50 terabytes.

Meu Plex com UHDs

Antes que venham dar palpite, sim, isso não é pra qualquer um. Estamos falando de 8 HDs de 10.9 TB, mais upgrade de 2…

Stefan’s Blog 

Extracting 2FA codes from the abandoned ‘Authenticator Plus’ (ios)

Recently, I moved iPhones and wanted to open my 2FA keys with the App “Authenticator Plus” - But Apple has removed it from the App Store. Unfortunately, the developer has gone inactive and the app is abandoned, hopefully, they are all right :/

But, I still had the app on my old iPhone and wanted to extract the keys. Here is how I did it:

Retrieve database

The App-Store discussion above outlines most of what I repeat here. Also, this blog post helped a lot: Nigelsim.org: Extracting Authenticator Plus

The app is also released for Android, so it should…

RubyGems Blog 

RubyGems is not vulnerable to the xz/liblzma backdoor

The past few days have seen the security world focused on the revelation of the xz/liblzma backdoor. For more background, see this early writeup of the issue, this GitHub Gist, this detailed timeline, and the official detail page for CVE-2024-3094.

In response to the backdoor becoming public, we have done an internal audit not just of the software used to run RubyGems.org itself, but also every gem that has ever been published.

We are happy to report that RubyGems.org is not vulnerable to this issue. Furthermore, we are happy to confirm that no gem currently published on RubyGems.org contains the vulnerable liblzma library.

I would like to thank the rest of the RubyGems.org security team…

Test Double 

Getting the exercises in Programming Flutter working in 2024

Recently I’ve been trying out Flutter to try to learn if and when I might want to reach for it on future projects. I enjoy learning by reading books, and this time I worked through Programming Flutter by Carmine Zaccagnino, published by The Pragmatic Programmers. It’s a great book that really helped me get some Flutter foundations under my belt. (Note: this isn’t an affiliate link and we aren’t receiving anything for recommending it; it’s just a great book!)

There was just one challenge working through the book: it was written in 2020, and both the Flutter framework and the Dart programming language have undergone some changes since then. Some were fairly easy to get past, and some…