Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
The Code Gardener 

Aspects of Agility

What does it mean to be agile?

  • Is it about doing a specific methodology?
  • Is it about following specific practices?
  • Is it about doing things by the book?
  • Is it about certifications?
Aspects of Agility

Those might be good entry points into learning to become agile. But, you can do all of those things and still not be agile. So, the question stands. What does it mean to be agile? 

Well, it depends on who you ask (and when):

  • Back in 2001, the authors of The Manifesto for Agile Software Development said being agile meant having a preference for working together directly, collaborating with customers, and responding to change in order to deliver working software.
  • Fifteen years later, Alistair Cockburn (one of the original…

Yet somewhere along the way, the word agile seems to have become synonymous with…

Passenger - Phusion Blog 

Passenger 6.0.22

Passenger 6.0.22

Version 6.0.22 of the Passenger application server has been released. This release fixes a couple issues with 6.0.21.

Passenger 6 introduced Generic Language Support, or: the ability to support any and all arbitrary apps.

Updates & improvements

  • [RPM] Fix dependency on selinux-policy. Closes GH-2545.
  • Fix Amazon Linux detection. Closes GH-3296.

Installing 6.0.22

Please see the installation guide for advice on getting started with Passenger. Coming from a language other than Ruby, Python, Meteor or Node? Even if we didn't write a specific tutorial for your language, we made a generic guide that shows you the steps.

Upgrading to 6.0.22

We strongly advise staying up to date with the latest…

Ruby on Rails 

Rails Versions 7.0.8.3 has been released!

Hi folks,

Rails versions 7.0.8.3 has been released!

These is a security release, and substitute the 7.0.8.2 that was previously released by has a bug with Trix CSS.

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

Here are the shasums for the released gems:

$ shasum *7.0.8.3*
fc6c722547a6c42d62a1b728db60f28f97da44f1  actioncable-7.0.8.3.gem
7abdf2c73233bf909eedf7ba56aa910b6d877c87  actionmailbox-7.0.8.3.gem
58315b74710473a62aca408b7e54e2ce6d1242f6  actionmailer-7.0.8.3.gem
27430a6d013397e7e7202c05b8d3e98c574596c5  actionpack-7.0.8.3.gem
2798ab84e24a77fd7f9cd595411a9be35a35af79 …
Ruby on Rails 

Rails Versions 7.0.8.2, and 7.1.3.3 have been released!

Hi folks,

Rails versions 7.0.8.2, and 7.1.3.3 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:

$ shasum *7.0.8.2*
c6c9318305c1cf4b86d3b78f8444806a414ef888  actioncable-7.0.8.2.gem
398650050120f28176eced97f31a99218df00f9d  actionmailbox-7.0.8.2.gem
d95a8da4dc79ce7e84721342dc18a40f7db72155  actionmailer-7.0.8.2.gem
f614e0921f3fead1183e51a26ffc373efbe4458c  actionpack-7.0.8.2.gem
d71bd159b1b8d75aae7aaa9cee37ec087bc6daa7 …
Ruby on Rails 

Start of Rails 8 development, 7.0.8.2 & 7.1.3.3 released, Kamal by default, and lots more!

Hey everyone, Happy Friday!

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

Development of Rails 8.0 starts now 🎉
This week marks the official start of Rails 8.0 development. Stay tuned for more updates on Rails 8.0 features and changes ahead 🎉.

Rails 8 will target Ruby 3.3+ only for new apps

Add Kamal by default to Rails 8
This PR adds Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml. This can be skipped using --skip-kamal. Check out more about Kamal on its official site.

Add support for :if_not_exists and :force options to create_schema
This change adds missing support for :if_not_exists and :force options to cr…

7.0.8.2 and 7.1.3.3 have been released
Two new Rails version have…

Once a Maintainer 

Once a Maintainer: Okura Masafumi

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

This week we’re talking to Okura Masafumi, a software developer based in Tokyo and lead organizer of the Kaigi on Rails conference, this October 25-26 in person and online. Okura has contributed to and created several open source projects including alba, a JSON serializer for Ruby, and as a longstanding user of Vim, translated the book Mastering Vim into Japanese.

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

How did you become a software developer?

My major in university was economics. I was not interested in computers at all at the…

Passenger - Phusion Blog 

Passenger 6.0.21

Passenger 6.0.21

Version 6.0.21 of the Passenger application server has been released. This release switches the RPMs to Nginx 1.24.0 on EL9 distros (RHEL, Rocky, Alma), and removes Ubuntu Mantic (23.10) packages, the addition of Ubuntu Noble (24.04LTS) packages is delayed due to an upstream bug.

Passenger 6 introduced Generic Language Support, or: the ability to support any and all arbitrary apps.

Updates & improvements

  • [Python] Fix version of Python when imp module is replaced with importlib. Contributed by Grigory Ponomarenko.
  • [Ubuntu] Remove packages for Ubuntu 23.10 "mantic".
  • [Nginx] Upgrades preferred Nginx to 1.26.0 from 1.24.0.
  • [Nginx] Switch to using PCRE2 instead of PCRE.
  • [Standalone] Fixes…
Saeloun Blog 

Ruby 3.4, Range#size Now Raises TypeError If The Range Is Not Iterable

In Ruby, a Range is an object that represents a range of values with a defined beginning and end. It is a fundamental data structure used to express a sequence or span between two values, whether they are numeric, alphabetical, or even dates.

We have two ways to define ranges.

# Inclusive Range (includes both start and end values)

inclusive_range = (start_value..end_value)

inclusive_range = (1..5)  #=> [1, 2, 3, 4, 5]
# Exclusive Range (excludes the end value)

exclusive_range = (start_value...end_value)

exclusive_range = (1...5)  # Includes 1, 2, 3, 4 (excludes 5)

#=> [1, 2, 3, 4]

Ruby Range#size method

Returns the number of elements in the range. Both the begin and the end of…

RubySec 

CVE-2024-35176 (rexml): REXML contains a denial of service vulnerability

### Impact The REXML gem before 3.2.6 has a DoS vulnerability when it parses an XML that has many `<`s in an attribute value. If you need to parse untrusted XMLs, you many be impacted to this vulnerability. ### Patches The REXML gem 3.2.7 or later include the patch to fix this vulnerability. ### Workarounds Don't parse untrusted XMLs. ### References * https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/
Awesome Ruby Newsletter 

💎 Issue 417 - Ruby 3.4, No More TypeError With **nil As It Is Treated As An Empty Hash.

John Nunemaker 

RailsConf 2024

RailsConf 2024

Last week I went to my first RailsConf in forever (2010). That's a decade and a half (almost)!

I saw old friends, met more recent online-only friends (in person) and made new friends!

Tuesday

Tuesday morning I drove to Detroit.

3 hours is a perfect drive. No need for bathroom stops or fuel and plenty of time to listen to multiple episodes of My First Million.

By the time I arrived at high noon, I was worked into a frenzy and ready to CONFERENCE (amirite).

I met up with Garrett for the first time in probably 15 years.

RailsConf 2024not even happy to see each other

We strolled to the conference center (like to OG's) and immediately ran into Dan Morrison, who I also haven't seen in forever. We had matching…

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

RubyMine 2024.2 Early Access Program Is Open!

Hello everyone!

We’re glad to announce the opening of the RubyMine 2024.2 Early Access Program. In this blog post, we’ll share what you can expect in this release cycle.

What’s coming in RubyMine 2024.2?

In this update, our goal is to enhance your RubyMine experience by incorporating new AI features, improving remote work capabilities, and integrating the latest technologies. We’ll also implement additional optimizations to RubyMine’s performance.

AI integration

In RubyMine 2024.2, we’ll introduce a number of updates for AI Assistant and the Full Line code completion plugin.

AI Assistant will receive additional contexts for specific Rails entities. This will improve…

Ruby Weekly 

A first glimpse of Ruby 3.4

#​703 — May 16, 2024

Read on the Web

Ruby Weekly

Ruby 3.4 Preview 1 Released — I love it when the first preview of a new Ruby version drops. It makes it easier to get playing with the new features and reminds me of Christmas.. 😂 It’s a preview so don’t throw it into prod (unless you’re Shopify) but it’s a good one to test against with a key change to how string literals now behave (I anticipate this could break a few dependencies..)

Yui Naruse

Free eBook: Advanced Database Programming with Rails and Postgres — Learn about subqueries, materialized views, and custom data types in Postgres and Rails. We…

Felipe Vogel 

The Ruby community is for everyone

Last week I attended RailsConf 2024 in Detroit. Others have written about how it pointed to a bright future for Ruby, or about how it was the best conference of their life.

I’ll join in the praise, but from a different angle. It’s somewhat personal, so if you’re looking for a more comprehensive recap, here’s a great writeup.

My angle: RailsConf was fruitful and inspiring for me even though I’m in a busy season of life as a new parent, with no time to be an entrepreneur or an open-source hero.

In other…

Rails, PostgreSQL Performance Audit and Tuning Consultant for Hire 

How to Simulate MEV Arbitrage with REVM, Anvil and Alloy

EVM simulation engine is a core component of any competitive MEV strategy. In this tutorial, I’ll describe how to use Anvil and its lower-level counterpart REVM to detect UniswapV3 MEV arbitrage opportunities. We will implement a working proof of concept using alloy-rs (a successor to ethers-rs). I’ll also discuss techniques for improving the performance and scalability of REVM-based simulations.

Calculating Uniswap V3 arbitrage profit

We will not build a full blown MEV bot in this tutorial. Instead, we will focus on a simulation engine for detecting arbitrage opportunities between Uniswap V3 pools on the Ethereum mainnet.

Uniswap V2 exchange rates are relatively straightforward to…

Ruby News 

Ruby 3.4.0 preview1 Released

We are pleased to announce the release of Ruby 3.4.0-preview1.

Language changes

  • String literals in files without a frozen_string_literal comment now behave as if they were frozen. If they are mutated a deprecation warning is emitted. These warnings can be enabled with -W:deprecated or by setting Warning[:deprecated] = true. To disable this change, you can run Ruby with the --disable-frozen-string-literal command line argument. [Feature #20205]

  • it is added to reference a block parameter. [Feature #18980]

  • Keyword splatting nil when calling methods is now supported. **nil is treated similarly to **{}, passing no keywords, and not calling any conversion methods. […

Core classes updates

Note: We’re only listing outstanding class updates.

  • Exception

    • Exception#set_backtrace now accepts arrays of Thread::Backtrace::Location. Kernel#raise, Thread#raise and Fiber#raise also accept this new format. [Feature #13557]
  • Range

Compatibility issues

Note: Excluding feature bug fixes.

  • Error messages and backtrace displays have been…
Ruby News 

CVE-2024-35176: DoS in REXML

There is a DoS vulnerability in REXML gem. This vulnerability has been assigned the CVE identifier CVE-2024-35176. We strongly recommend upgrading the REXML gem.

Details

When parsing an XML document that has many < in an attribute value, REXML gem may take long time.

Please update REXML gem to version 3.2.7 or later.

Affected versions

  • REXML gem 3.2.6 or prior

Credits

Thanks to mprogrammer for discovering this issue.

History

  • Originally published at 2024-05-16 05:00:00 (UTC)

Posted by kou on 16 May 2024

All about coding 

Add code snippet in RubyMine and Visual Studio Code to binding.break

Here is a quick way to add a manual breakpoint in the code using code snippets.

The code

What I usually want to see directly when I debug Ruby code and I cannot (or don't have time to set up the RDBG) is the variables and methods of the current object and the values of all instance variables and local variables at the breakpoint.

For this, I moved to use the debug gem, and I wrote:

binding.break(pre: 'ls ;; i')

Where (source):

  • ls - "Show you available methods, constants, local variables, and instance variables in the current scope"

  • i - "Show information about current frame (local/instance variables and defined constants)"

RubyMine

In RubyMine, code snippets are called Live Templates; you can find…

Giant Robots Smashing Into Other Giant Robots 

Why you should nest modules in Ruby

For the most part there’s no difference between these two ways of defining a class or module:

# nested
module Admin
  class User
  end
end

# inline
class Admin::User
end

The difference is often described as stylistic, but there are a couple of functional differences between the two approaches that you should be aware of before choosing one over the other.

To illustrate, imagine an app with User and Admin::User classes. Depending on how you reference those, you’ll get two different results:

module Admin
  class Nested
    def self.test = User.name
  end
end

class Admin::Inline
  def self.test = User.name
end

Admin::Nested.test # => "Admin::User"
Admin::Inline.test # => "User"

Here we…

Giant Robots Smashing Into Other Giant Robots 

Meet us at Helvetic Ruby 2024

Since I began my journey in tech almost a decade ago, I’ve loved attending conferences. They’ve not only taught me a lot but also helped me make some great friends. Trying new things, like giving my first talk and organizing events, has been really rewarding. And this week I’ll be at Helvetic Ruby 2024, happening on May 16th and 17th in Zürich, Switzerland.

Helvetic Ruby is co-organized by my thoughtbot teammate Dimiter Petrov. We’ll both be joining an Open Source Office Hours on the first day, where we’ll gather with community members to work together on open source. I have selected a few issues from Superglue and Administrate I’m excited to work on and pair with other attendees. You are…

The Amazing Blog 

Referencing Stimulus Controllers as ViewComponent Sidecar Files with Propshaft Importmaps

Referencing Stimulus Controllers as ViewComponent Sidecar Files with Propshaft Importmaps

AKA: How many Rails buzzwords can I fit in a single blog post title?

In a previous post, I described how I like to group related "Business Concept" objects together in app/aspects, rather than grouping them by type (app/jobs, app/commands, etc...)

In a sideproject I'm working on, I wanted to put my ViewComponent objects in that folder too, instead of app/components. Starting in ViewComponent 3, they support "sidecar" files, where you can put all the related files to that component in a subdirectory named the same as the component. Since I'm also using Stimulus for this project, and several of my…

Alchemists - Articles 

Git Rebase Abbreviations

Cover
Git Rebase Abbreviations

Git Rebase is my only workflow because it leads to clean Git histories, automatic release notes, improved team/stakeholder communication, leveling up of new team members, and so much more. This is especially true when coupled with Git Lint and Milestoner.

One of many tricks, when rebasing, is to reduce typing as much as possible. This article will teach you how to configure Git to use abbreviations to speed up your workflow and why this configuration is important. ⚡️

Table of Contents

Quick Start

To quickly configure Git with abbreviations enabled, run the following in your terminal:

git config --global

Setup

To set…

The Ruby on Rails Podcast 

Episode 515: Livestreaming Code On Twitch with Rachael Wright-Munn

I am very excited for today’s episode! Twitch is a livestreaming service where users can stream themselves to the internet. Twitch is known for video game streaming. But, people stream all kinds of things, including software development. Today's guest is Rachael Wright-Munn who livestreams Rails development on Twitch

Show Notes
Rachael’s Twitch: https://www.twitch.tv/chaelcodes
Find Rachael online: https://chael.codes/links
Nerd or die: https://nerdordie.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…

Notes to self 

Business Class 1.7: On the way to Rails 8

Here’s how Business Class 1.7 aligns itself with future Rails 8.

Rails 8 alignment

Rails 8 development only just started but Business Class 1.7 comes with most of distinguish Rails 8 defauls already:

  • Turbo 8
  • Solid Queue
  • Mission Control - Jobs
  • Thruster

Ruby was updated to 3.3.1 and Rails to the latest 7.1.3.2. And let’s not forget Kamal is part of Business Class for some time now.

Improved DevExp

Developer experience was also improved in this release. Hash IDs are used by default for URLs so you don’t have to overthink exposure of your internal IDs. A default installation now comes with the new HotwireCombobox component that’s just ready to be used. Provisioning was updated…

Saeloun Blog 

Rails 8 adds Kamal by default.

What is Kamal?

Kamal is a deployment tool developed by 37signals, designed to simplify the deployment of web applications by using Docker containers and the Traefik reverse proxy for seamless, zero-downtime deployments.

Before

Before Rails 8, we had to manually install Kamal into our project and then do the setup.

Installation:

gem install kamal

Or add it to the Gemfile of the project.

# Gemfile
gem 'kamal', require: false

and then run

bundle install

Initialize Kamal

kamal init

This creates a default configuration file at config/deploy.yml and a .env file.

After

Rails 8 now adds Kamal by default.

While creating a new rails app with rails new <app_name>, an entry for kamal gem…

Ruby Magic by AppSignal 

Creating Forms in Ruby on Rails with Simple Form

Ruby on Rails has changed how we build web applications. Early on, the framework came with some great features to help you get started and build robust applications.

However, it can still be tricky to build and handle forms. Simple Form is a great option. Let's examine what Simple Form is, why we might need it, and some real use cases.

Forms and Ruby on Rails

Ruby on Rails really simplifies building applications. Yet, it also requires your constant attention to keep your codebase streamlined and coherent. One strategy is to avoid writing code by using abstractions, for example. Code that isn't in your actual application is code you don't have to manage. That's why we like abstractions so…

RubyGems Blog 

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

RubyGems News

In April, we released RubyGems 3.5.8 and 3.5.9, and Bundler 2.5.8 and 2.5.9. These releases bring a series of enhancements and bug fixes designed to improve the overall developer experience with RubyGems, including: a security improvement that adheres to global umask settings when writing files, a fix for the NoMethodError crash linked to issues with corrupt package files, and a resolution for an error message problem in the resolver when it runs out…

Some other important accomplishments from the team this month…

BigBinary Blog 

Difference between dependencies, devDependencies and peerDependencies

In a JavaScript project, understanding the distinctions between dependencies,devDependencies, and peerDependencies is crucial for effective packagemanagement. Each plays a distinct role in shaping how a project is built anddistributed. In this blog, we'll explore these terms and their differences.

dependencies

The packages that are really needed for a project to function should be listedunder dependencies. These packages are always installed within that project.If the project is also a package, then these dependencies will also getinstalled in the host project that uses this package. Below are some commonexamples of what might go under dependencies.

 "dependencies": {   "dayjs": "1.11.1",  …
The Code Gardener 

The Coffee Machine Series: As a patron, I want cocoa

The Coffee Machine Series: As a patron, I want cocoa

Welcome to the fifth in a series of posts in which we will answer the questions:

  • How does complexity sneak into software?
  • How can we recognize it before it becomes painful?
  • And, how can we remove it permanently?

Here's a link to the previous post: As a patron, I might want condiments.

As a patron, I want cocoa

Ok. Our inbox is no longer full of such bitter feedback. But, there is one request that we haven't yet fulfilled. Some of our customers would like cocoa, rather than coffee or tea. So, let's extend our software.

Here's how to make cocoa:

  • Dispense a cup
  • Heat some water
  • Add cocoa mix to the cup
  • And, pour the hot water into the cup

Updating the Driver

As with the addition of tea, the hardware team…

Ryan Bigg's Blog 

What was that branch?

When I’m working in an app I tend to have multiple branches on the go at any one time while waiting for feedback on those branches, be that feedback from CI systems or people. Occasionally, it’s a few days / weeks between visits to a branch because the flow of work meant it that way. And sometimes, I forget what the branch name was.

To help with this, I’ve got this function in my ~/.zshrc:

fbr () {
	local branches branch
	branches=$(git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format="%(refname:short)")  && branch=$(echo "$branches" |
  fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m)  && git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}

T…

RubySec 

GHSA-r95h-9x8f-r3f7 (nokogiri): Nokogiri updates packaged libxml2 to v2.12.7 to resolve CVE-2024-34459

## Summary Nokogiri v1.16.5 upgrades its dependency libxml2 to [2.12.7](https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.7) from 2.12.6. libxml2 v2.12.7 addresses CVE-2024-34459: - described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/720 - patched by https://gitlab.gnome.org/GNOME/libxml2/-/commit/2876ac53 ## Impact There is no impact to Nokogiri users because the issue is present only in libxml2's `xmllint` tool which Nokogiri does not provide or expose. ## Timeline - 2024-05-13 05:57 EDT, libxml2 2.12.7 release is announced - 2024-05-13 08:30 EDT, nokogiri maintainers begin triage - 2024-05-13 10:05 EDT, nokogiri [v1.16.5 is…
Radan Skorić's personal site 

Hidden feature of Turbo: stream actions inside regular HTML

The feature Turbo stream actions are a central feature of Turbo, allowing for control of the webpage from server side. In essence, turbo stream actions are a piece of custom HTML markup that Turbo has a special way of interpreting as an action to execute rather than as content to be rendered. Here’s what the official documentation has to say about when they can be used: You can render any...
The Bike Shed 

426: Bringing "Our Selves" to Work

Joël shares his preparations for his RailsConf talk, which is D&D-themed and centered around a gnome character named Glittersense. Stephanie expresses her delight in creating pod-related puns within thoughtbot's internal team structure, like "cross-podination" for inter-pod meetings and the adorable observation that her pod resembles "three peas in a pod" when using the git co-authored-by feature.

Together, Stephanie and Joël discuss bringing one's authentic self to work, balancing personal disclosure with professional boundaries, and fostering psychological safety. They highlight the value of shared interests and personal anecdotes in enhancing team cohesion, especially remotely,…

Short Ruby Newsletter 

Short Ruby News - Edition #90

The one when we celebrate RailsConf 2024
Posts on Kevin Murphy 

Four Things To Take Away From RailsConf 2024

RailsConf 2024 🔗

Now that RailsConf 2024 is behind us, I want to share some key takeaways that I left Detroit with. I also have a full recap available of what I saw while I was there.

1. #RubyFriends Is More Than A Hashtag 🔗

I cannot overstate the importance of your professional network. In the Ruby community, we talk a lot about Ruby Friends. How you build and cultivate that group is up to you. Conferences have been a main driver of that forme.

The reason I was on the Program Committee is because of the conference relationships I’ve built. I congratulated Ufuk on joining the Ruby Central board at RubyConf last year. I (sincerely) told him to keep me in mind if I can help in the future. He…

Saeloun Blog 

Ruby 3.4, No More TypeError With **nil As It Is Treated As An Empty Hash.

In Ruby, the splat * and double splat ** operators are used for handling variable-length arguments in methods, especially when dealing with arrays and hashes.

The Single Splat operator (*) constructs and spreads out Arrays.

If we use it when defining a method, it constructs into an array.

def example_method(*args)
  puts "args are: #{args}"
end

example_method(3, 5, 7) 

# => args are: [3, 5, 7]

If we use it when passing arguments as an array, it deconstructs the array into arguments.

def example_method(a, b, c)
  puts "args are: #{a}, #{b}, #{c}"
end

example_method(*[3, 5, 7]) 

# => args are: 3, 5, 7

The double Splat operator (**) It works similarly. We can construct and spread…

If we use it…

Posts on Kevin Murphy 

RailsConf 2024 Recap

RailsConf 2024 🔗

RailsConf recently wrapped up in Detroit, Michigan. This post is meant to highlight the great work from all involved. I hope you’ll seek out the full videos of all the sessions that interest you once they are available. Unfortunately, I couldn’t be everywhere, so this covers what I saw.

I’ve separately compiled a list of brief takeaways.

Preparing 🔗

I had a bit of work to do leading up to the conference. It was my honor andpleasure to serve on the Program Committee for RailsConf this year. Mainly this meant reading all of the proposals. And then the even more difficult work to whittle that down to our program.

The committee broke into smaller groups. I was on the tracks group,…

Giant Robots Smashing Into Other Giant Robots 

How We Used a Custom Enumerator to Fix a Production Problem

Enumerators are a powerful Ruby feature. Did you know that you can create custom enumerators with custom logic? Today, I will tell you how we fixed a production problem with a custom enumerator.

Problem

We had a method like the following:

def customer_property_ids
  sql = "SELECT DISTINCT PropertyId from AddressMatch"
  client.execute(sql).map { _1["PropertyId"] }
end

It runs a Microsoft SQL Server query that returns an array of property IDs. In Ruby, arrays implement the Enumerable interface by default, so we can use the rich assortment of Enumerable methods to iterate over them.

Other methods from the same class relied on the array returned by customer_property_ids; we had…

zverok's space 

The things I haven't wrote, and the things I want to write (back to Ruby)

For three months already, I haven’t published anything on my blog/Substack. In truth, I have a few drafts/half-written posts/unfinished projects to share, but neither of them felt like being worth completing. The amount of duties my service requires has changed recently, too, leaving me much less spare time to write. But if I am being honest with myself, that’s not the primary reason for the silence.

This text is written as some sort of personal reflection on what and why I want to write. It also serves as a public commitment for future texts (and a way to break writer’s block!).

In the upcoming weeks/months, I intend to write a series of posts on various aspects of Ruby’s evolution and…

Hotwire Weekly 

Week 19 - Stimulus LSP v1.0, StimulusReflex v3.5, and more!

Hotwire Weekly Logo

Welcome to Hotwire Weekly!

Welcome to the another issue of Hotwire Weekly! RailsConf just happend this week in Detroit. There were a few Hotwire-adjacent talks, which should be published within the next month. Until then, Happy reading! 🚀✨

Stimulus LSP v1.0 released - Marco Roth published the v1.0 release of the Stimulus LSP. It ships the completely overhauled Stimulus Parser release to improve accuracy and false-positives. Download it from the Visual Studio Code Marketplace.

📚 Articles, Tutorials, and Videos

Hotwire Back Button - Dom Christie published a blog post in which he talks about a Stimulus back button for full-screen progressive web apps, where the browser’s own back button is…

Headless UI with…

Dhaval Singh's Blog 

Looping defaultdict In Templates: A long-standing "Bug" in Django

I am new to Django and recently spent a good chunk of time trying to debug what I thought was quite trivial. Looping a defaultdict in templates.

This is a pretty common pattern when using Django, using a dict to pass and render data via templates, but there is something to be learned here. Let's jump into it!

The "Bug"

When you have a defaultdict whose default value is a list, you might run into this issue. Here is a simple example:

from collections import defaultdict# Create a defaultdict with default type listdd = defaultdict(list)# Add some values to the defaultdictdd['fruits'].append('apple')dd['fruits'].append('banana')dd['vegetables'].append('carrot')dd['vegetables'].append('broccoli')

If…

GarrettDimon.com Posts 

The Bright Future of Ruby and Rails

The steady improvements to both Ruby and Rails combined with an amazing and supportive community have me deeply excited about the future of both.

The Code Gardener 

This One Time at Tropical.rb

This One Time at Tropical.rb

Back in December, kind of on a whim, Fito and I submitted a couple of proposals to Tropical.rb, the largest Rails conference in Latin America. "Wouldn't it be amazing," we gaped. "We could visit family in Asunción, friends in Montevideo, and then head to São Paulo to speak at the conference and make more friends."

Then this happened...

This One Time at Tropical.rb

Tropical.rb selected our Brewer's Guide talk! Before we knew it, there were posts on LinkedIn announcing us as speakers...

Tropical.rb confirmed speaker images for Alan Ridlehoover and Fito von Zastrow

And, then, almost eight thousand miles later, Fito and I became international speakers!

And, here's the proof! Enjoy!

And, here's the deck...

Ruby Rogues 

Ruby in the Browser: Exploring Web Performance, Reactivity, and Front-End Complexity - RUBY 636

Cameron Dutro is the Staff Software Engineer at GitHub. They dive deep into the world of web development and explore the latest trends, challenges, and innovations. In this episode, they have an enlightening discussion on the state of front-end development with a focus on Ruby and Rails. They delve into the use of web components, the limitations of existing technologies, and the potential for a new Ruby implementation, Garnet, to revolutionize front-end development. From the impact of Hotwire to the challenges of integrating front-end frameworks, this episode offers valuable insights and thought-provoking discussions for developers navigating the ever-evolving landscape of web development. 

naildrivin5.com - David Bryant Copeland's Website 

Estimates are Fine. They Build Trust When You Provide Them And Deliver On Them

Marco Rogers asked about estimates on Mastodon, and I agree with a lot of what he’s written. Engineers often think they should not have to do estimates, going so far as to champion the “no estimates” movement, or claiming that engineers should not have to be accountable for their work. Writing software is expensive, and the people paying for it have every right to ask the developers when it might be done.

I want to go through a process for giving an estimate and running a project, since both are intertwined. Successful delivery makes estimates easier, and realistic estimates support successful delivery. After that, I’ll touch on why estimates are not some evil thing that is done to us…

The Code Gardener 

A Gardener's Reward

A Gardener's Reward

I had the privilege of sharing my Gardener's Reward lightning talk at RailsConf 2024 in Detroit this week. It's based on a post I wrote a couple of years ago called When a Flower Doesn't Bloom. My friend, Fito, was kind enough to record the talk. The transcript is below the video.

Drew Brag: "Alan, take it away!"

Alan Ridlehoover:

Hello! I'm Alan. I'm with Cisco Meraki. And, before I begin, I want to say a heartfelt thank you to both Ruby Central, the organizers, and all the volunteers – I see several in the room – thank you! [Applause] And, also, thank you to everyone here! This conference wouldn't have been the same without you. Sincerely, each individual. I mean it.

Ok. I want to talk about…

Stefan’s Blog 

Speed up Rails/Rspec test by parallelization + asset pre-precompile + Gitlab-CI/Coverage integration

To speed up our build and deployment time, we recently implemented test parallelization for our two biggest app. By doing so, we reduced the total deployment time of one service from 50min down to <20min. Both services had problems with flaky tests, that are gone now. In this post, I will outline the steps we took to achieve this + scripts.

Parallelization + distribution of tests

We use Test-boosters Gem, which is a simple runner, that splits all tests into a defined number of groups and runs one of those groups. Each runner itself does not use parallelization, but you utilize multiple CI-Runners/workers for parallelization.

To determine the load, we made a small scripts, that takes the…

Write Software, Well 

Understanding Rails Parameters

Understanding Rails Parameters

If you are building a dynamic web application, you will need to access the user-submitted data on the server. Maybe the user uploaded a photo, wrote a comment, posted a tweet, or clicked a link containing the id of an article they want to read, and you want to read this data to do something useful.

How do you access this data on the server, in your Rails application?

Answer: Rails parameters let you access the user-submitted data in your Rails application, specifically in your Rails controllers.

💡
Similar to the function parameters, Rails parameters read the data submitted by the user, either in the link or via form submission and make it available in your Rails application in the params hash.

Remote Ruby 

Continuous Delivery and Continuous Self-Improvement

In this episode, Jason, Chris, and Andrew reflect of their experiences of developing software, focusing on aspects such as the Fast and Furious franchise, writing in Ruby, React development, and grappling with OAuth 2.0 issues.

They dive into testing, specifically the challenges of maintaining a meaningful test suite and the revelations from addressing test suite problems.

A discussion on containerization touches on Docker and CI setup frustrations, while also exploring web accessibility standards and the potential of Web Components, specifically through the new Web Awesome project.

The conversation takes us through various technical and personal insights, highlighting the continual…

Ruby on Rails 

Rails community survey, improved association validation errors and more

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

The bi-annual Rails community survey is live!
Your input is invaluable and will help the team at Planet Argon gather insight on the current state of the Rails community. Fill in the survey here. (And feel free to share with your teams). The survey will remain open until August 2nd, 2024, and the findings released shortly thereafter.

A New Era for Ruby Central Events
Ruby Central announced that 2025 will be the last year of RailsConf and they are inviting the community to vote on where the last edition should be held. Read the full announcement here, and cast your vote.

Fix index_errors and provide :nested_attributes_order…

Awesome Ruby Newsletter 

💎 Issue 416 - Ruby typing 2024: RBS, Steep, RBS Collections, subjective feelings

Ruby Weekly 

An interactive system testing UI for Capybara

#​702 — May 9, 2024

Read on the Web

Ruby Weekly

Thinking About Typing in Ruby in 2024 — A prolific developer reflects upon his recent experiences with Ruby 3’s support for explicit typing, by way of RBS, after some historical experience with Sorbet. He had a reasonable experience, but fears RBS may remain an avant garde add-on like Ractors rather than a part of the mainstream Ruby experience.

Brandur Leach

IRB Adding Support for Easily Extending Its Functionality — The interactive IRB REPL has long been at the heart of the Ruby development experience, but it’s not the easiest of tools to extend. No…

Josh Software 

Mastering Overflow Challenges in Text, Image, and Container Widgets

Flutter offers a wealth of widgets to build stunning user interfaces. But with great flexibility comes the challenge of managing overflow in each widget. Overflow occurs when content exceeds the space available for display, leading to messy UI (user interface) issues. In this guide, we will explore how to tackle overflow in various widgets, offering … Continue reading Mastering Overflow Challenges in Text, Image, and Container Widgets
Notes to self 

Running Thruster with Rails and Kamal

Thruster is a new zero config proxy from 37signals. Here’s how to add it to an existing Rails projects deployed with Kamal.

Thruster and Kamal

Thruster solves 4 things as a proxy for Puma:

  • HTTP/2 support
  • HTTPS with Let’s Encrypt
  • HTTP caching of public assets
  • X-Sendfile support and compression

This makes sense as it was created to handle self-hosted ONCE products without Kamal. However, we don’t really need all of that if we already run Rails with Kamal. We handle TLS either directly with Traefik or Cloudflare, and offload storage concerns to CDNs.

So do we need Thruster at all?

X-Sendfile

Thruster still improves serving application assets like stylesheets and JavaScripts…

Saeloun Blog 

Enhancing Data Integrity With validate_foreign_key In Rails

Rails offers powerful tools for managing database relationships, including the use of foreign key constraints.

Foreign key

Foreign key constraints establish a relationship between two tables in a database, ensuring that the value in a column (the foreign key) in one table matches a value in the primary key column of another table. This relationship helps maintain referential integrity, preventing orphaned records and ensuring data consistency.

Before

Let’s assume we’re building an application that stores articles and their respective authors. We’ll have two models, Article and Author. In case of relational DB, these are linked via foreign_keys.

Each article is linked to its…

Ruby Magic by AppSignal 

Debugging in Ruby with pry-byebug

For a software engineer, even the basic use of a debugger can save a lot of pain: adding breakpoints (places in the code the program will stop at and expose the current context) is very easy, and navigating from one breakpoint to another isn't difficult either.

And with just that, you can say goodbye to a program's many puts and runs. Just add one or more breakpoints and run your program. Then you're able to access not only the variables and objects you might have thought of, but also anything accessible from that point in the code.

In this article, we'll focus on pry-byebug, a gem that adds debugging and stack navigation to pry using byebug. We will see how to set up and use pry-byebug,…

BigBinary Blog 

Grafana Loki and Kubernetes Event exporter

In the previousblog, wediscussed integrating Prometheus andGrafana in the Kubernetes Cluster. In this blog, we'llexplore how to integrate theKubernetes Event exporter& Grafana Loki into your Kubernetes Clusterusing a helm chart.

Additionally, youll also learn how to add Grafana Loki as a data source to yourGrafana Dashboard. This will help you visualize the Kubernetes events.

Furthermore, we'll delve into the specifics of setting up the Event exporter andGrafana Loki, ensuring you understand each step of the process. From downloadingand configuring the necessary helm charts to understanding the Grafana Lokidashboard, we'll cover it all.

By the end of this blog, you'll be able to fully utilize…

Evil Martians 

Keep it together: 5 essential design patterns for dev tool UIs

Authors: Gleb Stroganov, Product Designer, and Travis Turner, Tech EditorTopics: Design, User Interface Audit, Accessibility

UI design can often make or break a successful developer tool. This post covers 5 essential dev tool UI patterns in a way so that even non-designers can get their project off the ground.

UI design is a critical factor that can often make or break a successful developer tool. Whether you're creating a tool for designers, engineers, creatives, or any other tool tailored for developers, this post is for you. (Even if you're not a designer!)

Ruby Central 

A New Era for Ruby Central Events

A special announcement for the Ruby community

We normally announce next year’s RailsConf location at the end of the conference, but this time we are going to do something a little different and share two pieces of news:

We are delighted to announce that we want to involve you all in deciding where we will have RailsConf next year. Please use this Google Form to share your feedback.

We have also decided that RailsConf 2025 will be our final one. Beyond 2025, we will be focusing on RubyConf as our flagship event, as we deepen our involvement in supporting regional conferences, meetups, and open source development.

RailsConf 2025 will be reimagined to be a more focused celebration of the Rails…

The Bike Shed 

425: Modeling Associations in Rails

Stephanie shares an intriguing discovery about the origins of design patterns in software, tracing them back to architect Christopher Alexander's ideas in architecture. Joël is an official member of the Boston bike share system, and he loves it. He even got a notification on the app this week: "Congratulations. You have now visited 10% of all docking stations in the Boston metro area." #AchievementUnlocked, Joël!

Joël and Stephanie transition into a broader discussion on data modeling within software systems, particularly how entities like companies, employees, and devices interconnect within a database. They debate the semantics of database relationships and the practical…

Honeybadger Developer Blog (Ruby Articles) 

Running Solid Queue in production Rails apps

Background jobs are essential to many Ruby on Rails apps. Since the introduction of ActiveJob, Rails developers have been able to manage their background jobs as natively as they do their database records. Still, ActiveJob requires you to select (and support) a backend adapter that will implement ActiveJob's backend. Many use Redis, a memory cache, to queue and process background jobs. Redis comes with incredible speed but is yet another dependency to maintain.

Solid Queue is a new backend for ActiveJob. It was announced at Rails World, along with Solid Cache. Like Solid Cache, Solid Queue moves away from memory solutions like Redis and towards the database. Solid Queue takes advantage of…

Short Ruby Newsletter 

Short Ruby News - Edition #89

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

Exploring Early Career — Part 3: Finding and Leveraging a Mentor

Exploring Early Career — Part 3: Finding and Leveraging a Mentor

Co-authored by Varsha Balasubramaniam

Neon sign that says “Go up and never stop”

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…

GoRails Screencasts 

Refactoring Local Variables To Methods

Sometimes you write code to get a feature working and stop there. With a little refactoring, you can extract local variables into methods that make testing and extending easier.
Giant Robots Smashing Into Other Giant Robots 

Advanced Ruby: The Chainable Request Pattern

In the previous article of my series on error handling and fault tolerance, we discussed how to run external API requests in a transaction while handling errors and making it fault-tolerant. That article is not a requirement to understand this one, so read on in either case!

Here, we will explore some means of abstraction for the transactional pattern. You will learn how to encapsulate API requests for use in an external transaction, including:

  • Automatic rollback on error;
  • Support for running custom code in between requests;
  • Chain multiple API requests with automatic rollback support;
  • Return a chained result of all API requests.

Let’s call it the “Chainable Request Pattern”.

Hotwire Weekly 

Week 18 - Hotwire at RailsConf, migrating from React to Hotwire, and more!

Hotwire Weekly Logo

Welcome to Hotwire Weekly!

Welcome to the another issue of Hotwire Weekly! RailsConf is happening in Detroit next week. There are also going to be a few Hotwire-adjacent talks:

  • "Revisiting the Hotwire Landscape after Turbo 8" by Marco Roth on Thursday at 9 am.
  • "Insights Gained from Developing a Hybrid Application Using Turbo-Native and Strada" by John Pollard on Thursday at 10 am.
  • "Dungeons & Dragons & Rails" by Joël Quenneville on Thursday at 11 am.
  • "Progressive Web Apps with Ruby on Rails" by Avi Flombaum on Thursday at 2:30 pm.

If you want to hack on anything Hotwire-related on the Hackday on Tuesday come find Marco Roth!

Happy reading! 🚀✨


📚 Articles, Tutorials, and Videos

How to…

Fullstack Ruby 

Episode 10: Ruby un Rails (and Proof of Life Update)

The rumors are true: I became a Ruby developer because of Rails. It’s probably common that folks find a tech stack or framework which offers the features and the community they desire and so learn the language undergirding that stack. Truth is, Ruby did not appeal to me at first and I resisted it! I wanted to remain a PHP developer, damnit! But the industry draw of Rails required me to learn Ruby, and I eventually fell head-over-heels in love with this language. Now I find myself at a crossroads. Do I leave Ruby behind because I’m no longer a “Rails developer”? Or do I embrace the essence of what makes Ruby Ruby and forge a different path? Gather around, my fellow devs, and listen to my…

Links & Show Notes:

Drifting Ruby Screencasts 

Tips and Tricks

In this episode, we look at various tricks in Ruby on Rails as well as some other neat tricks.
Write Software, Well 

Working with Resourceful Routes in Ruby on Rails

What I've come to embrace is that being almost fundamentalistic about when I create a new controller to stay adherent to REST has served me better every single time.

Every single time I've regretted the state of my controller, it's been because I've had too few of them. I've been trying to overload things too heavily.

- David Heinemeier Hansson, on
Full Stack Radio
Working with Resourceful Routes in Ruby on Rails

The concept of resources is very powerful in Rails. With a single call to a method named resources, Rails will generate seven different routes for you, saving you a lot of typing.

But saving a few keystrokes is just the cherry on top. The biggest benefit of using resourceful routing is that it provides a nice organizational…

Everyday Rails 

Testing with RSpec book May 2024 status report

How it started, how it's going, what I've learned, and a revised delivery timeline for book updates.
Ryan Bigg's Blog 

code is like garden

Code is like garden.

Sometimes, you come into garden and find out past gardener put sun-loving plant in the cupboard at the back of the shed. You discover more sheds and cupboards later on.

The materials used in shed construction make you think past gardener may have been ticking off a list of known elements, rather than trying to build sturdy shed.

Past gardener put picket fence going vertically up the side of one shed. You ask other gardeners why the fence is there and they say “it’s always been that way”. No other shed has a fence.

Some gardeners like a particular brand of hand trowel and get into religious arguments over which hand trowel is better.

Sometimes, GM (Garden Manager)…

Ruby on Rails 

Rails console improvements, assertionless tests reporting and more!

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

Build Rails console on top of IRB’s latest official APIs
The Rails console is built on top of IRB, but due to the lack of an extension API, it was extending it with monkey patches. Since IRB received a lot of improvements and an extension API recently, this pull request changes the Rails console to be built on top of that. This will make the Rails helpers show up in the help message among others wins.

Turn app:update into a command to add –force
This pull request changes the app:update task to be a Rails command, and then adds the --force flag to it, to allow running bin/rails app:update while accepting all the…

Fix count queries on includes+references for models with composite…
Since…

RubyGems Blog 

3.5.10 Released

RubyGems 3.5.10 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:

  • Add a limit to the size of the metadata and checksums files in a gem package. Pull request #7568 by segiddins

## Enhancements:

  • Don’t fully require rubygems from rubygems/package to prevent some circular require warnings when using Bundler. Pull request #7612 by deivid-rodriguez
  • Installs bundler 2.5.10 as a default gem.

## Bug fixes:

  • Rename credential email to identifier in WebAuthn poller. Pull request #7623 by jenshenny

SHA256 Checksums:

  • rubygems-3.5.10.tgz
    bbabd…
Saeloun Blog 

Rails Adds GitHub CI Workflow By Default To New Applications

Continuous Integration/Continuous Deployment, also known as Continuous Delivery or CI/CD, is a software development technique that aims to automate the steps involved in integrating code changes into a shared source code repository, testing those changes, and automatically deploying those changes to target environments without the need for human intervention.

It makes early error detection easier and minimises the amount of code that needs to be debugged by a developer to identify the fault’s source.

It also forms the basis of contemporary DevOps operations, facilitating more fluid and agile collaboration between development and operations teams.

Several well-known CI/CD solutions…

RubySec 

CVE-2024-32970 (phlex): Phlex vulnerable to Cross-site Scripting (XSS) via maliciously formed HTML attribute names and values

There is a potential cross-site scripting (XSS) vulnerability that can be exploited via maliciously crafted user data. The reason these issues were not detected before is the escapes were working as designed. However, their design didn't take into account just how recklessly permissive browser are when it comes to executing unsafe JavaScript via HTML attributes. ### Impact If you render an `` tag with an `href` attribute set to an user-provided link, that link could potentially execute JavaScript when clicked by another user. ```ruby a(href: user_profile) { "Profile" } ``` If you splat user-provided attributes when rendering any HTML or SVG tag, malicious event attributes could be…
Awesome Ruby Newsletter 

💎 Issue 415 - Choosing the Right Audit Trail Approach in Ruby

Once a Maintainer 

Once a Maintainer: Rafael França

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

This week we’re talking to Rafael França, member of the Rails Core team since 2012 and contributor with the most commits to the framework. Rafael is a Principal Engineer at Shopify where he leads the team responsible for the Ruby and Rails ecosystem within the company.

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

How did you come to be on the Rails Core team?

I guess I always wanted to be part of Rails Core, at least as soon as I knew what the Rails Core team actually was. But in reality, how it came to be is that one of the Rails Core…

Ruby Weekly 

ActiveRecord::Core#inspect woes

#​701 — May 2, 2024

Read on the Web

Ruby Weekly

Fixing a Footgun in ActiveRecord::Core#inspect — Objects have an inspect method that returns a string representation that can be useful in development and debugging. ActiveRecord objects do too, with some added enhancements to highlight what you need to know. It turns out, however, inadvertently calling on ActiveRecord::Core#inspect in production can cause real performance issues..

Andrew Novoselac

Explaining Thruster, 37signals' HTTP/2 Proxy to Speed Up Your App — Available as a gem, though written in Go, Thruster is an HTTP/2 proxy server that addresses…

Saeloun Blog 

Rails 8 Adds GitHub CI Workflow By Default To New Applications

Continuous Integration/Continuous Deployment, also known as Continuous Delivery or CI/CD, is a software development technique that aims to automate the steps involved in integrating code changes into a shared source code repository, testing those changes, and automatically deploying those changes to target environments without the need for human intervention.

It makes early error detection easier and minimises the amount of code that needs to be debugged by a developer to identify the fault’s source.

It also forms the basis of contemporary DevOps operations, facilitating more fluid and agile collaboration between development and operations teams.

Several well-known CI/CD solutions…

Ruby Rogues 

The Life and Death of a Rails App with Olivier Lacan - RUBY 635

Olivier Lacan joins the panel again. He currently works for Pluralsight. Today they are talking about the spectrum of creating a Rails app, or any app, from the birth of the idea to the death of the project. They stress the importance of planning for updates. Olivier talks about his experience in maintaining Code School, which has now been incorporated into Pluralsight. David also shares his experience with the life and death of a project. They talk about technical debt and the trouble that it can create, and the importance of making your Rails application maintainable. 
Olivier talks about his experience when Code School was acquired by Pluralsight. The panel discusses the inevitability of…
Rails at Scale 

Fixing a footgun in ActiveRecord::Core#inspect

The inspect method on Active Record models returns a string including the model’s class and a list of all its attributes and their values. In Rails 7.2, you can configure which attributes are included in the output of inspect. In this post, I’ll discuss the performance issue that led me to implement this feature. I’ll also talk about how this feature can be used to improve developer experience.

to_s vs. inspect

Objects in Ruby define both to_s and inspect methods. Conventionally, to_s returns a string representation of the object, while inspect returns information about the object that can be used for debugging purposes.

Let’s take a look at how to_s and inspect work for Active Record…

Book.
Schneems - Programming Practices, Performance, and Pedantry 

Docker without Dockerfile: Build a Ruby on Rails application image in 5 minutes with Cloud Native Buildpacks (CNB)

I love the power of containers, but I’ve never loved Dockerfile. In this post we’ll build a working OCI image of a Ruby on Rails application that can run locally without the need to write or maintain a Dockerfile. You will learn about the Cloud Native Buildpack (CNB) ecosystem, and how to utilize the pack CLI to build images. Let’s get to it!

This post is extracted from a tutorial I wrote for Heroku Cloud Native Buildpacks. Future revisions will be updated on the GitHub repo.

Install the pack CLI

We assume you have docker installed and a working copy of git. Next, you will need to install the CLI tool for building CNBs, pack CLI. If you’re on a Mac you can install it via Homebrew:

$…
Alchemists - Articles 

Module Builder Pattern

Cover
Module Builder Pattern

The Ruby Module Builder Pattern allows you to encapsulate customizable behavior — and store state — which can be applied when extending, including, and/or prepending existing objects (i.e. classes or modules). This solves situations where you need a module to be configurable which is not possible by default.

To illustrate, the following provides the Ruby object hierarchy for modules and classes:

Cover

Notice that modules and classes are siblings to each other while also children of Object (via Kernel). Normally, a Module is not a superclass of Class but I added a green dashed line that shows what the hierarchy looks like when a Class is taught to inherit from …

Ruby Magic by AppSignal 

AnyCable for Ruby on Rails: How Does it Improve over Action Cable?

In modern web applications, real-time communication has become more than a feature: it's gradually evolved into a necessity. Users expect instant updates, live interactions, and dynamic content.

In Rails applications, Action Cable has long been the go-to solution, harnessing WebSockets to fulfill these demands. In this article, we introduce:

  • The basics of WebSockets
  • How Action Cable enables real-time communication via WebSockets
  • Why AnyCable was created
  • How to get AnyCable up and running
  • The improvements AnyCable brings to the table

Let's get started!

The WebSocket Technology

The WebSocket technology was introduced in 2011 with the publication of RFC 6455, titled "The WebSocket Protocol".…

Evil Martians 

Let's have more tech meetups! A quick-start guide to holding your own

Authors: Irina Nazarova, CEO, and Travis Turner, Tech EditorTopics: Events, Ruby

Technical meetups are truly the best way to connect to people with similar passions. So, let’s bring them back! Here’s our quickstart guide based on our successful experience organzing a tech meetup in the San Francisco Bay Area.

Technical meetups offer something so real and unique, and are truly the best way to connect with people who have similar passions. So, let’s bring them back! As a practical example, let me summarize how we organized one of our recent events: our SF Bay Area Ruby meetup. For this one, we had 160 signups and about 70 attendees, and everything went really well! Read on for our own personal…

Nithin Bekal 

Running LLama 3 and Phi-3 locally using ollama

Over the past few days, there have been a couple of interesting new LLM releases with Meta’s Llama 3 and Microsoft’s Phi-3 Mini. Aside from ChatGPT, I haven’t really played with any of the other models, so I decided to try running these locally on my Macbook.

I expected that installing LLMs locally would be complicated, but with ollama I had them running on my Intel Macbook in a matter of minutes.

Installation

Install ollama:

brew install ollama

ollama needs to run as a background service:

brew services start ollama

Install and run Llama 3:

ollama run llama3

This will download the 8B version of Llama 3 which is a 4.7GB file, so it might take a couple of minutes to start. If you…

The Bike Shed 

424: The Spectrum of Automated Processes for Your Dev Team

Joël shares his experience with the dry-rb suite of gems, focusing on how he's been using contracts to validate input data. Stephanie relates to Joël's insights with her preparation for RailsConf, discussing her methods for presenting code in slides and weighing the aesthetics and functionality of different tools like VS Code and Carbon.sh. She also encounters a CI test failure that prompts her to consider the implications of enforcing specific coding standards through CI processes.

The conversation turns into a discussion on managing coding standards and tools effectively, ensuring that automated systems help rather than hinder development. Joël and Stephanie ponder the balance…

Short Ruby Newsletter 

Short Ruby News - Edition #88

A Monday summary of the articles, discussions, and news from the Ruby community
Ryan Bigg's Blog 

One year with the Ergodox EZ

A year ago I upgraded from a Kinesis Freestyle Edge to an Ergodox EZ. What initially enticed me was the thumb keys, as well as the ability to program different macros into the “spare” keys littered around the board. (I still have the Kinesis Freestyle sitting in storage, buyers enquire within…)

I used Monkeytype to practice typing on the keyboard, and the stats there show that it took me about a month to go from the initial speed of 40wpm (quite painful) back up to 90wpm. That’s when I started feeling properly comfortable with it. I can now do about 130wpm on this keyboard, which is the same speed I could do on the Freestyle and my laptop keyboard.

I originally bought the Kinesis keyboard…

JRuby.org News 

JRuby 9.4.7.0 Released

The JRuby community is pleased to announce the release of JRuby 9.4.7.0.

JRuby 9.4.x targets Ruby 3.1 compatibility.

Thank you to our contributors this release, you help keep JRuby moving forward! @kares, @ryannevell, @jsvd

Ruby Compatibility

Standard Library

  • jruby-openssl is updated to 0.14.5
  • rdoc is updated to 6.4.1.1
  • Warnings due to method aliasing in the ostruct library have been mitigated. #8200, #8206

JVM Integration

  • Ruby classes that are “reified” into a Java class and later…
The Amazing Blog 

Using Local Font Files in the Rails 7.1 Asset Pipeline

Using Local Font Files in the Rails 7.1 Asset Pipeline

I wanted to play with the new hotness of Rails asset handling in a sideproject, and ran into some fiddliness in getting FontAwesome webfonts to be seen when loading them from an SCSS file. I'm using propshaft and Dart Sass in this app to build my CSS assets, and there wasn't any documentation I could find on how to reference your local font files within your SCSS files.

I happen to have a FontAwesome 5 Pro license from back when it was a KickStarter lifetime license, so that's what I'm using. FontAwesome 6 Pro is now a $100/yr subscription, which doesn't make sense for random side-projects, but I imagine these instructions will work…

naildrivin5.com - David Bryant Copeland's Website 

Ruby's Complex Branching Options

Working on some personal projects where I’m not constrained by older versions of Ruby or on Rails, I’ve been trying to learn and use features of Ruby introduced in the last few years. One feature is pattern-matching, and it’s caused me to ask the question: what is the best way to create a branching control structure in Ruby?

Before going into this, I was solidly team if statements, but now I’m not so sure.

Let’s say we are writing code to validate HTML forms, server-side. The basic interaction we want, in Sinatra-esque pseudo-code is:

post "/widgets" do
  result = NewWidget.call(params)

  if results failed data validation
    render "widgets/new", widget: params,
Gusto Engineering - Medium 

Gusto is heading to RailsConf 2024 in Detroit!

Illustration of folks collaborating both remotely and in person.

At Gusto, we empower over 300,000 businesses to hire, pay, and manage their teams. This includes services such as payroll, health insurance, 401(k)s, expert HR, and team management tools. All of these platforms use Ruby on Rails as their backends.

We are very excited to join RailsConf 2024 and support this community as a gold sponsor. If you’ll be at the conference, we’d love to connect!

Where you’ll find us

All week at Booth #8, near the Ruby Cafe

Come find us at the Gusto booth. We’ll have yard games, giveaways and some very cozy couches where you can take a breather and charge your devices before hitting up your next talk. Have you worked in a Rails monolith before? Do you want to chat about…

Giant Robots Smashing Into Other Giant Robots 

Rack_Test or Selenium ?

Improving performance for your test suites is one of those things that can easily get overlooked when starting a new project but gets increasingly crucial as the test suites grow. a faster test suite results in less time waiting for the tests to run which saves time during development and increases productivity for developers.

In this article, we will explore the differences between selenium and rack_test and how you can leverage them to speed up your test; we will use Rspec as our testing framework for this article.

Rack::Test

Speed: It is generally faster than Selenium because it does not require a server or a browser to run tests. `rack_test` interacts directly with Rack…

Hotwire Weekly 

Week 17 - Dark Mode with Tailwind/Stimulus, Animating Data Filtering, and more!

Hotwire Weekly Logo

Welcome to Hotwire Weekly!

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

Happy reading! 🚀✨


📚 Articles, Tutorials, and Videos

Turbo & Progressive Enhancement - Dom Christie wrote an article about Progressive enhancements and Turbo. The article emphasizes on building web applications that function without JavaScript by using Turbo for progressive enhancement. It's illustrating how this approach can lead to simpler and more adaptable code.

Turbo Native & Strada: Turning a web-only Rails app native! - Kevin Liebholz gave a presentation about Turbo Native and Strada at the Ruby Meetup Frankfurt in April. The recording is now…

Dark Mode for Rails with Tailwind and Stimulus - Cody…

RubySec 

CVE-2024-32887 (sidekiq): Reflected XSS in Metrics Web Page

Reflected XSS in Sidekiq Web UI via the `/metrics` HTTP end-point and the `substr` query param: https://{host}/sidekiq/metrics?substr=foot%22%3E%3Cscript%20src=%22{payload}%22%20/%3E
Saeloun Blog 

ActiveRecord::Base#pluck adds support for hash values in Rails 7.2

In day-to-day life, we see many dashboards which consist of charts and reports. To build these charts or reports quickly, we required specific data from different database tables in faster queries.

The ActiveRecord::Base#pluck method is used to query single or multiple attributes from the database without loading the entire record. It returns the results as an array of attribute values.

User.pluck(:id, :name, :email)

The above code will result in the following query:

SELECT users.id, users.name, users.email FROM "users"

The above query returns the following output:

=>
  [
    [1, "David Heinemeier Hansson", "dhh@hey.com"],
    [2, "Rafael França", "rafael@franca.dev"],
    [3, "Vipul…

Before

We are not limited to querying fields…

Ruby on Rails 

Rails World 2024 tickets on April 30, legacy index name format for Rails 7.0, etc

Emmanuel Hayford here, writing from Toruń, Poland.

We’ll keep this one short.

Tickets for this year’s Rails World will be available for purchase on Tuesday, April 30, 2024, at 1 PM EDT from the official Rails World site. The Foundation has more information on tickets here.

On to your weekly dose of Rails updates:

Pre-7.1 Rails migrations use legacy index names when using rename_table
This pull request ensures compatibility for Rails versions before 7.1 by retaining the legacy index name format. Beginning with version 7.1, Rails introduced a new index name format. Consequently, migrations containing rename_table might generate index names distinct from those created between Rails 7.0 and…

Ruby Rogues 

Avo: Building Custom Interfaces, Managing Users, and Creating Authorization Systems - RUBY 634

Adrian Marin is the Co-Founder and CTO at SuperStuff.a. He is also the Author of Avo Admin for Ruby on Rails. They delve into the world of Ruby on Rails and explore the latest developments in the tech industry. Adrian shares his journey of building Avo, his approach to differentiation, and the emphasis on customization and user support. They also discuss the challenges and maturity of open-source projects, sustainability, and the importance of offering free and paid versions to cater to diverse user needs. Join them as they uncover the technical aspects of gem distribution and the upcoming Friendly.rb conference in Bucharest, Romania. 
Sponsors
Closer to Code 

Karafka 2.4 Release Announcement: Advancing Kafka Processing for Ruby and Rails

Introduction

I am thrilled to announce the release of Karafka 2.4, a significant milestone in the evolution of my Ruby and Rails multi-threaded efficient Kafka processing framework. This release builds upon the solid foundation laid by its predecessor, Karafka 2.3. It introduces many new features, enhancements, and improvements across the entire Karafka ecosystem, including Karafka, Web UI and WaterDrop.

In this article, I will discuss the most significant changes and enhancements introduced in Karafka 2.4. Please note that this is not an exhaustive list of all the changes but rather a curated selection of the most impactful and noteworthy improvements. For a complete list of changes,…

Awesome Ruby Newsletter 

💎 Issue 414 - From a Lorry Driver to Ruby on Rails Developer at 38

Ruby Weekly 

Auto-tuning your GC settings

#​700 — April 25, 2024

Read on the Web

Ruby Weekly

Autotuner: Speed Up Your Rails App with GC Tweaks — You can get some serious performance boosts if you tweak Ruby's garbage collection settings, but there are a lot of them, and it’s easy to get lost. Autotuner is a new tool from Shopify that can provide suggestions on how to best tune things based upon actual data collected while your app is running.

Peter Zhu

Ruby 3.3.1 (and More) Released — Due to the discovery of an arbitrary memory address read vulnerability when user-supplied data is provided to Ruby’s regex compiler, releases of all maintained…

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…