Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Gusto Engineering - Medium 

The Weirdest Bug I’ve Seen Yet

How digging into an on-call issue led to an unlikely culprit

What in tarnation?

During one of my on-call rotations for our internal tools team, we got a report that Chrome was crashing for users of Gusto’s internal software. This was causing all sorts of interruptions to our normal customer service. Gusto employees in the middle of answering customer emails or phone calls might suddenly find themselves without visibility into customers’ accounts necessary to do their jobs.

Chrome browser showing crash errorChrome tab crash

This was fairly far outside the usual scope of our on-call issues. Our team is generally well-insulated by other teams from issues like browser compatibility, so I didn’t know the first thing about browser…

The Ruby Dispatch 

Turbo 8 in 8 minutes

Turbo 8 simplifies the development of live-updating Rails applications. It offers a dramatic leap forward from previous versions by minimizing the need for manually coding turbo frames and turbo stream responses. This advancement simplifies both the creation and maintenance of Rails applications making you even more productive.

If you’re not familiar with Turbo, it’s a library used widely by Ruby on Rails applications to partially update pages, making them feel as responsive as single-page JavaScript applications. It’s similar to frameworks like HTMX, StimulusReflex, Phoenix LiveView, and Laravel LiveWire.

Think of Turbo 8 as a really smart page reloader

That’s an oversimplification, but…

Saeloun Blog 

Rails 7.1 Introduces Default Dockerfiles

In the world of web development, the optimization of deployment processes plays a crucial role in enhancing efficiency.

Rails 7.1 introduces an exciting enhancement by providing default Docker-related files for new applications to make the setup process easier and simplifies the deployment process of our application in production environments using Docker.

The Dockerfile, .dockerignore, and bin/docker-entrypoint are now bundled within the Rails application. These files cater specifically to production deployments rather than local development.

Docker steps

  • Build the Docker image:
docker build -t blog-app .
  • Create a Docker volume:
docker volume create app-storage
  • Run the…
AkitaOnRails.com 

[Akitando] #148 - O que IAs podem fazer? | Exemplos de Ferramentas

Sim, este episódio foi inteiramente gerado por ferramentas de IA, em particular HeyGen e ElevenLabs. Fiz bem curto pra não ficar cansativo demais. Mesmo sendo impressionante, no atual estágio não é possível fazer videos do tamanho que costumo fazer no canal.

Primeiro, o HeyGen não consegue fazer videos maiores do que 1 minuto sem que a qualidade decaia muito. Eu tentei fazer videos de mais de 2 minutos e do nada ele começava a halucinar e me fazer falar em espanhol, por exemplo.

Segundo, o treinamento é super limitado. Ele só me deixa subir uns 5 minutos de amostra de video. É muito pouco e isso resulta em muito pouca variância nos movimentos. Muito pouca diversidade de jeito de falar.…

Ruby Magic by AppSignal 

Keep Your Ruby Code Maintainable with Money-Rails

When working with money in an application, ensuring everything is accounted for is important.

In this post, we will explore some common methods and best practices of handling money in your Ruby app, and see how you can use money-rails to write maintainable money-handling code.

Let's get started!

Use Cases for Storing Money

There are several use cases where your Ruby app might need to handle money — for example, an e-commerce company that sells products, a SaaS maintaining users' subscriptions, etc.

In this post, we will walk through some examples of how to handle money in an e-commerce app.

Storing Money in a Ruby Database

First, let’s start with strategies for storing money in your…

The Ruby on Rails Podcast 

Episode 497: Rachel Moser on The Odin Project

Rachel is a core contributor to The Odin Project, an open source education project that helps people learn Ruby and Javascript. She joined me on the show to talk about the project, how she became involved, and her role with the team.

Show Notes
The Odin Project - https://www.theodinproject.com/
Rachel's Github - https://github.com/rlmoser99

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 specifically for devs.

Get started today in as…

Write Software, Well 

Announcing: Crash Course on Turbo (Hotwire) Framework

💡
TL;DR: I am announcing the beta version of my crash course on Turbo (Hotwire). You can check it out here: courses.writesoftwarewell.com
Announcing: Crash Course on Turbo (Hotwire) Framework

Throughout this year, I wrote a bunch of articles on Hotwire and its frameworks, especially Turbo. So far, the most common feedback from the readers (especially the new subscribers to the blog) has been to provide a step-by-step learning path providing all the essential information for a Rails developer to understand Hotwire.

And that's what I've been doing for the past two weeks (hence the delay in publishing new articles on the blog, as some of you may have noticed).

If you are connected with me on LinkedIn, you know I announced the crash-course last week.…

Hanami Mastery newest episodes! 

#51 Font awesome icons in Hanami apps!

Probably any web app nowadays requires font icons to be loaded this or other way. In this episode, I'm showing the integration of Font Awesome icons in Hanami 2 applications.
The Bike Shed 

408: Work Device Management

Joël recaps his time at RubyConf! He shares insights from his talk about different aspects of time in software development, emphasizing the interaction with the audience and the importance of post-talk discussions. Stephanie talks about wrapping up a long-term client project, the benefits of change and variety in consulting, and maintaining a balance between project engagement and avoiding burnout.

They also discuss strategies for maintaining work-life balance, such as physical separation and device management, particularly in a remote work environment.


Transcript:

STEPHANIE: Hello and welcome to another episode of The…

Radan Skorić's personal site 

Using Turbo Frames and Streams without Rails

Recently I’ve been using Turbo frames and streams more and wanted to really understand how they work. To do that I set out to rebuild a very simple To-Do application (peak originality!), using Turbo but without Rails or turbo-rails gem. I did that using Sinatra1. As you’ll see, it was really simple. So simple I wondered if it’s worth a blog post. But then I realised that is kind of interesting ...
Evil Martians 

Care beyond code: 7 best design practices for frontend developers

Authors: Nina Torgunakova, Frontend Engineer, and Travis Turner, Tech EditorTopics: Frontend, CSS, JavaScript

Frontend can be about more than just code—we’re also the last bastion helping our teams against pesky design bugs! We share 7 best design practices for frontend engineers.

As a frontend engineer, it’s actually pretty easy not to think about the design of the project you’re working on–but this attitude can lead to bad UX, visual bugs, and even feature delivery delays. Read and learn how to mind the design, become a better specialist, and bring value to your project beyond just writing code.

BigBinary Blog 

Serving assets and images in Next.js from a CDN without Vercel

neetoCourse allows you to build and sell coursesonline. BigBinary Academy runs onneetoCourse. neetoCourse uses Next.js to build its pages.

If one uses Vercel to deploy a Next.js application, Vercelautomatically configures a global CDN.However, neetoCourse is hosted atneetoDeploy, our own app deploymentplatform. This meant we had to figure out how to serve assets and images from aCDN. We like using Cloudflare for various things and we decided to useCloudflare as the CDN for this case.

There are two kinds of files in a server-side rendered Next.js app that can beserved from a CDN.

  • Assets like server-rendered HTML, CSS, JS, and fonts.
  • Public media like images and videos. These typically reside in…

Server rendered assets

When Next.js…

Short Ruby Newsletter 

Short Ruby News - Edition #69

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

Consider a small donation to rubyland.news?

I started rubyland.news a few years ago because it was a thing I wanted to see for the Ruby community. I had been feeling a shrinking of the ruby open source collaborative community, it felt like the room was emptying out.

If you find value in Rubyland News, just a few dollars contribution on my Github Sponsors page would be so appreciated.

I wanted to make people writing about ruby and what they were doing with it visible to each other and to the community, in order to try to (re)build/preserve/strengthen a self-conception as a community, connect people to each other, provide entry to newcomers, and just make it easier to find ruby news.

I develop and run rubyland.news in my…

Ruby on Rails 

The official Rails job board is live

The mission of the Rails Foundation is to help the Rails ecosystem prosper, and one way we can do that is by connecting programmers and companies working with Rails. So today we’re introducing the official Rails Job Board, a platform for Rails developers to find their next role (and companies to find their next Rails developer).

Whether you’re a senior Rails developer seeking new challenges, a contractor looking for part-time work, a company eager to add a junior developer to your team, the Rails Job Board is the best place to find your next match.

Job seekers, browse remote and hybrid developer roles in companies around the world. Be sure to subscribe to the newsletter or the RSS feed to…

Saeloun Blog 

Rails 7.1 Adds ActiveJob#perform_all_later To Enqueue Multiple Jobs At Once

Traditionally, enqueuing multiple jobs involved individual calls, leading to potential performance bottlenecks when dealing with large volumes of tasks.

Before

Below is an example of using sidekiq as adapter and to enqueue multiple jobs it makes lot of round trips to Redis

# app/jobs/email_notification_job.rb

class EmailNotificationJob < ApplicationJob
  queue_as :default

  def perform(user_id)
    # Code to send an email notification to the user
    puts "Sending email notification to user #{user_id}"
  end
end

# Enqueuing EmailNotificationJob for multiple users
User.find_each do |user|
  EmailNotificationJob.perform_later(user.id)
end

After

Enter perform_all_later method…

Dhaval Singh's Blog 

To raise or not to raise?

Did you know they have ashtrays in Airplane bathrooms even tho smoking is banned inside!? It turns out there is a good reason for them, and youll be glad theyre there. In case a passenger does illegally sneak a ciggy, planes must have a safe place to put out the butts.

ashtray

This intriguing detail has significantly influenced my perspective on system design. Having that ashtray even though smoking is banned just shows how critical it is to ensure safety in Airplanes and I've always wanted the systems I build to be similar in this aspect. Resilient and Robust in the face of a bad input or an error.

So I started reading about this stuff and boy is it confusing! Rightly so, because exception…

a-chacon 

Asynchronous Loading in Active Record: Boosting the Performance of your Rails Application 🚀

Optimize performance in Rails 7.1 with asynchronous data loading using Active Record and the load_async method. Reduce response times by running queries in parallel, improving the efficiency of your application.
André Arko 

Homebrew cask formula for private GitHub repo releases

I try to use my dotfiles to install software for myself, mainly via Homebrew. This week, I ran into a new automation problem: I wanted to start using a program only available from a private GitHub repo, which requires authentication for downloads. To make things worse, new versions release frequently, so I can’t use a static link to the GitHub Release entry’s asset download link.

I ended up doing a bunch of experimenting and searching, and I initially found several posts about private GitHub repos, mostly centered around the idea of setting a special environment variable with a GitHub API token and then writing a custom Homebrew download strategy class.

I didn’t want to have to keep track…

Ruby on Rails 

ErrorReporter#unexpected, with_routing test helpers and more!

Happy Thanksgiving weekend everyone! This is Vipul bringing you the latest from this week’s changes in the Rails codebase.

ErrorReporter#unexpected to report in production but raise in development
This change adds ErrorReported#unexpected to report precondition violations.

For example:

  def edit
    if published?
      Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
        return false
    end
      # ...
  end

The above will raise an error in development and test, but only report the error in production.

Make with_routing test helper work for integration tests
with_routing test helper support has now been added to ActionDispatch::I…

Support nested…

RubyGems Blog 

October 2023 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 October.

RubyGems News

This month in RubyGems, we released RubyGems 3.4.21 and Bundler 2.4.21.

A couple of noteworthy updates this month include the introduction of a feature to abort setup.rb for outdated Ruby versions - #7011, and efficiency enhancements enabled by removing Dir.chdir from subprocess execution - #6930. We also achieved a major configuration improvement by implementing a pure-ruby YAML parser -#6615. The documentation also saw significant improvements,…

RubyGuides 

From Complexity to Clarity: Mastering Ruby’s Pattern Matching Features

An amazing new feature is now available in Ruby, it’s called pattern matching & it lets you extract specific values from complex data structures like arrays, hashes, and objects using concise syntax.

In addition, it helps you check that these objects match a specific structure, so it works as a form of object validation.

Since Ruby 3.0, this feature is no longer experimental (there is an exception, as we will see later) so now you’re free to start using it in all your projects! 🙂

Matching Hash Structure

In this example, we’ll do something very interesting that, before pattern matching, took some extra work to accomplish.

And that is…

Checking if an array has certain keys &…

zverok's space 

“Useless Ruby sugar”: Argument forwarding

This is a part of a blog post series about “useless” (or: controversial) syntax elements that emerged in recent Ruby version. The goal of the series is not to defend (or criticize) the features, but to share a “thought framework” for analysis of their reasons, design, and effect the new syntax has on a code that uses it. See also intro/ToC post.

Today’s post covers the feature that, unlike most of the others in the series, caused very little pushback: a set of shortcuts for argument forwarding.

What

Since Ruby 2.7, this is possible (please note that ... in the code below is the exact valid syntax, not “code omitted for a blog post”):

def foo(...)
  # bar receives all positional,…
Ruby Rogues 

Building Honey Badger with Ben Curtis - RUBY 614

Ben Curtis is the co-founder of Honeybadger Industries. They dive into the world of Honey Badger. From its humble origins as a side project to becoming a successful exception monitoring service, Honey Badger has seen steady growth and positive customer reviews. Ben shares the challenges they faced along the way, their guerrilla marketing tactics, and their recent launch of a new feature.


Sponsors


Links


Socials



Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy
Hi, we're Arkency 

Who calls who? — a simple events heuristic

Who calls who? — a simple events heuristic

When integrating two components, you may wonder who should own the commands and events you want to use for communication. Today, I will show you a simple heuristic that may help you make this decision. The heuristic relies on the frequency of change in components. Before using it, we should visualize relationships between those components. Context Mapping is a perfect tool for that, as it shows how changes in one Bounded Context affect others (there is an excellent resource about the concept itself here).

And now, without further ado, let’s jump into an example. Let’s assume that we have two components: Registration and Payment. Registration

Giant Robots Smashing Into Other Giant Robots 

Ruby HTML Sanitization with Loofah

This post was originally published on the hexdevs blog.


As a Rails developer, when you want to sanitize some user’s HTML input, you just write <%= sanitize some_user_provided_string %> and call it a day.

But sometimes, this helper is not what you really need. You need to sanitize the user-provided HTML string outside of a Rails view or template. For example: when the unsafe HTML string comes from an integration, and you need to clean it before storing it.

That’s when the Loofah gem shines. It is a Ruby library for HTML/XML transformation and sanitization, built on top of Nokogiri. Fun fact: you can provide a custom Loofah scrubber to the Rails sanitize method 💡

Ruby HTML…

Awesome Ruby Newsletter 

💎 Issue 392 - Ruby is the Top 6th Highest Paid Programming Language in 2023, with a salary MEDIAN of $136k per year.

BigBinary Blog 

Perfecting mobile responsiveness on neetoSite using RFS

<style>table{table-layout:fixed;width: auto !important;}table td,table th{padding:4px 12px !important;}</style>

Introduction

Responsive design has become fundamental to modern web development as usersaccess websites from various devices with varying screen sizes.neetoSite is a website-building tool byneeto. We strive for a great user experience on alldevices for sites built using neetoSite.

This blog will discuss implementing responsive typography, padding, and marginusing the RFS package.

At neetoSite, users can personalize font sizes from the design page. If a userselects the largest font size (9xl) for the title, everything looksflawless on the desktop view. However, when switching to…

Ruby Weekly 

Why to add IRB to your Gemfile

#​679 — November 23, 2023

Read on the Web

Ruby Weekly

TestProf III: Guided and Automated Ruby Test Profiling — TestProf is a long standing suite of tools to improve test suite performance, and it’s ‘back’ with lots of new features and enhancements. These include a playbook for getting started with test suite profiling, a new ‘autopilot’ CLI tool to automate the generation and merging of StackProf reports, and MemoryProf, a system that tracks memory usage during test runs.

Vladimir Dementyev

Free eBook: Advanced Database Programming with Rails and Postgres — Learn about subqueries, materialized views,…

Julia Evans 

git branches: intuition & reality

Hello! I’ve been working on writing a zine about git so I’ve been thinking about git branches a lot. I keep hearing from people that they find the way git branches work to be counterintuitive. It got me thinking: what might an “intuitive” notion of a branch be, and how is it different from how git actually works?

So in this post I want to briefly talk about

  • an intuitive mental model I think many people have
  • how git actually represents branches internally (“branches are a pointer to a commit” etc)
  • how the “intuitive model” and the real way it works are actually pretty closely related
  • some limits of the intuitive model and why it might cause problems

Nothing in this post is remotely…

Saeloun Blog 

Understanding Generators, Iterators, and Iterator Helpers in JavaScript

When working with collections of data in JavaScript, iterators and iterator helpers are essential concepts to grasp. They allow developers to traverse through elements efficiently and manipulate data in various ways. In this article, we will explore the concepts of iterators, generators, yield, next(), and iterables, focusing on JavaScript, and understand how iterator helpers simplify our coding experience.

Understanding Generators:

  • Generator:

    Generators are special functions that can be paused and resumed. They allow us to define an iterative algorithm by writing a single function which can maintain its state, and the state can be paused at any time and later resumed.…

Ruby Rogues 

How To Recession Proof Your Job - BONUS

Get the Black Friday/Cyber Monday "Double Your Productivity by 5pm Today" Deal

Coupon Code: "THRIVE" for a GIANT discount


Are you looking at all the layoffs and uncertainty going on and wondering if your company is the next to cut back? 


Or, maybe you're a freelancer or entrepreneur who is trying to figure out how to deliver more value to gain or retain customers?


Mani Vaya joins Charles Max Wood to discuss the one thing that both of them use to more than double their productivity on a daily basis.


Mani has read 1,000's of productivity books over the last several years and has formulated a methodology for getting more done, but found that he lacked the discipline to follow through on his plans.


T…

Ruby Magic by AppSignal 

Shaping the Future of Ruby and Kafka Together with rdkafka-ruby

Hello there! My name is Maciej Mensfeld, and some of you might recognize me from my involvement in RubyGems Security, OSS commitments, or perhaps from Karafka: a multi-threaded, efficient Kafka processing framework tailored for Ruby and Rails.

While I generally pen my thoughts on my personal blog, today's post is unique. This article results from a collaborative effort with the brilliant people over at AppSignal. To set the record straight, I don't work for AppSignal. However, I felt that AppSignal's blog would be the most appropriate platform for this piece due to its nature.

Karafka Embraces rdkafka Gem

We're happy to stand behind the rdkafka-ruby gem, a brainchild of AppSignal. Their…

GoRails 

Black Friday Sale 2023!

It's hard to believe it's holiday season already and 2023 is almost over. Our Black Friday sale is live and we do this every year as a way to show our appreciation for all the support the Ruby on Rails community has given us over the years. We've grown from a 1 person company to 3 to continue growing and supporting the Ruby on Rails community. Kent, Collin, and I want to say thanks for all your support that makes this possible and we promise to continue creating the best Rails education and tools we can.

Here are the Black Friday sales for 2023:

36% off GoRails with the yearly plan - Get the deal

Get a yearly subscription to GoRails for just $144/year. That's only $12/mo to stay…

The Ruby on Rails Podcast 

Episode 496: Live From The RubyConf Hallway Track

I attended Ruby Conf and took the opportunity to chat with some attendees about their experience at the conference. This was a super fun experiment and getting to hear from new voices in the community was such a treat. I hope you enjoy it!

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 specifically for devs.

Get started today in as little as 5 minutes at Honeybadger.io with plans starting at free!

ScoutAPM
This episode of The Ruby on…

Mike Coutermarsh 

Building a webhooks service

I recently had the chance to work on building webhooks for PlanetScale. As part of this, I learned quite a lot about the possible security vulnerabilities that running a webhooks service can expose you too.

You might be surprised with all the risks there are!

Everything I learned is over on the PlanetScale blog. I hope you find it helpful next time you're building webhooks for your application.

Bonus: Rails webhook models

For the Rails developers, here are the models I used when building the service. The goal was to keep it as simple as possible (can always add on more later).

There are two models, one for storing the webhook. And another for storing all the…

Felipe Vogel 

A Rubyist learns Haskell, part 1

Lately a question has been on my mind, a classic for programmers:

“What language should I learn next?”

More specifically: “A language that has jobs, or one that I would actually enjoy?”

I struck a good balance a few years ago when I taught myself Ruby along with front-end basics, which I enjoy a lot and got me hired as an entry-level engineer. In fact, I’d be happy spending the next ten years…

Greg Molnar 

Using thor for command line tasks

Last week, while creating a small Rails app for myself, I had to import data from an XML file. I wanted to add a command line task for it. I could’ve used rake for this, but I needed to input the path to the file through a command line parameter, and rake isn’t ideal for that. Fortunately, there’s another tool that’s better suited for this task: Thor.

Evil Martians 

TestProf III: guided and automated Ruby test profiling

Authors: Vladimir Dementyev, Principal Backend Engineer, and Travis Turner, Tech EditorTopics: Backend, Performance Audit and Optimization, Ruby, Ruby on Rails, Continuous Integration

TestProf is back with new features and tips on how to hunt slow Ruby tests and improve the developer experience by reducing feedback loop times.

The trend towards better developer experience (and developer tools) is increasing. Engineers crave smarter tools and faster feedback loops to maximize productivity. In the Ruby on Rails community, the latter usually implies long-running CI/CD builds due to slow tests. The introduction of TestProf six years ago made Ruby developer lives easier and their tests much…

OmbuLabs Blog 

Hacktoberfest 2023: How We Merged Open Source Contributions with Learning Objectives

As a company, one of our core values is to be “open by default.” At the same time, one of our goals is to use our open source investment time as a way to improve our skills as engineers and designers.

In that spirit, this year we decided to organize our open source contribution time in a way that wasn’t limited to our own open source projects. This is a short post to explain how we aligned our open source contributions with our learning goals, what contributions we made, and why it mattered.

Our Motivation

Last year, as a company, we did an exercise in participating in Hacktoberfest with our team. There were positive and negative notes but, overall, feedback around the exercise itself…

Saeloun Blog 

Rails 7.1 Expands ActiveRecord API with Async Query Support

Traditionally, ActiveRecord queries have been synchronous, causing the application to pause and wait for the database to respond before continuing execution.

While this synchronous behavior works well in many cases, it can become a bottleneck when dealing with lengthy or resource-intensive queries, impacting the overall responsiveness of the application.

Asynchronous querying, however, is executed in a background thread. This enables our application main thread to remain responsive and handle incoming requests concurrently while the queries are executed in the background.

This asynchronous approach drastically enhances performance, especially in scenarios where waiting for the database…

Short Ruby Newsletter 

Short Ruby News - Edition #68

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

407: Tech Opinions Online with Edward Loveall

Stephanie interviews Edward Loveall, a former thoughtbotter, now software developer at Relevant Healthcare.

Part of their discussion centers around Edward's blog post on the tech industry's over-reliance on GitHub. He argues for the importance of exploring alternatives to avoid dependency on a single platform and encourages readers to make informed technological choices. The conversation broadens to include how to form opinions on technology, the balance between personal preferences and team decisions, and the importance of empathy and nuance in professional interactions. Both Stephanie and Edward highlight the value of considering various perspectives and tools in software…

Max Chernyak 

Long Term Refactors

Big (or Long Term”) refactors are hard to pull off in a busy company. To succeed, we must:

  • Convince business that it’s worth the delay.
  • Decide what features will have to wait.
  • Produce regular status updates and ETAs.
  • Justify the refactor as we go. Is it the right approach?
  • Keep ourselves from burning out.
  • Allow time for the team to digest and review the huge diff.
  • Fix a bombardment of QA issues.

And we better do this all quickly, because god forbid original and refactored code coexist!

Is this really the only way? Feature freeze, a rush, a buggy rollout, and likely burnout?

The Other Way

I have a theory that long refactors get a bad rap because most of them take far longer than we…

Giant Robots Smashing Into Other Giant Robots 

What's a Counter Cache?

Nowadays users of modern web and mobile applications expect a fast response for each interaction. As developers, we need to be aware of the performance of our applications and how we can improve it. This involves constantly searching for potential bottlenecks, and especially looking for inefficient queries when we are dealing with large amounts of data.

One of the most common performance issues in Rails applications is the N+1 query problem. This problem occurs when we are loading a collection of records and for each record we are running a separate query to count how many records are associated with that record.

A common example

Imagine that your web application is about…

naildrivin5.com - David Bryant Copeland's Website 

Web Components: Templates, Slots, and Shadow DOM Aren't Great

In two previous posts, I explored the custom elements part of Web Components, concluding that the lifecycle callbacks provide value beyond rolling your own. I want to look at the other two parts of Web Components, which are the Shadow DOM and the <template> tag. These provide a templating mechanism that doesn’t work like any other web application templating environment and is incredibly limiting to the point I must be just not understanding.

Let’s start with the <template> element. This element allows you to place markup into the DOM that is ignored by the browser and has no semantic meaning. This is pretty useful, because the only way to approach this is to do something hacky like…

Honeybadger Developer Blog (Ruby Articles) 

How to build your own user authentication system in Rails

When building an app, you'll probably need to handle user authentication in one form or another. In Rails applications, several pre-built libraries and gems make it a breeze to build user authentication including well-known libraries like Devise, Doorkeeper and OmniAuth. These libraries work well out of the box, but there's a caveat, as developers must follow certain configuration and design rules for each library. Therefore, some developers might prefer to roll out their own authentication layer and configure it to their specifications. In this article, we'll explain how to build a custom authentication layer from scratch for a Ruby on Rails app.

Prerequisites

You'll need the following…

Passenger - Phusion Blog 

Passenger 6.0.19

Passenger 6.0.19

Version 6.0.19 of the Passenger application server has been released. This release rounded out our support for arm64 (also called aarch64) by adding el8 & 9 aarch64 rpms and prebuilt generic arm64 binaries for rubygems installs of Passenger.

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

Updates & improvements

  • [Ruby] Fix compatibility with Rack 3 header array. Closses GH-2503.
  • [Ruby] Preserve SIGPROF signal handlers. Contributed by Ivo Anjo. Closes GH-2489.
  • [Python] Replaces use of imp module with importlib in Python 3. Contributed by Rongxin Liu. Closes GH-2399 and GH-2501.
  • [Ubuntu] Removes packages for Ubuntu 18.04 "Bionic" (EOL…
Evil Martians 

Extremely open and incredibly close: should you go open source?

Authors: Irina Nazarova, CEO, and Travis Turner, Tech EditorTopics: Business, Full Cycle Software Development

Every founder building for developers must inevitably consider if the product should be open sourced. And if so, how to approach this from the financial perspective? We share a detailed list of open source business strategies.

Every founder building for developers, including those founders at a stage where they're still only thinking about their future product, will inevitably consider this question: should their product be open sourced, and, if so—why?

naildrivin5.com - David Bryant Copeland's Website 

What is WebComponents Buying Us?

People saying that “Web Components are having a moment” should look at the difference between Web Components and just using the browser’s API. They are almost identical, so much so that I’m struggling to understand the point of Web Components at all.

Let’s take Jim Neilsen’s user avatar example and compare his implementation to one that doesn’t use Web Components. This will help us understand why there is so much client-side framework churn.

Update on Nov 19, 2023: Based on reader feedback, I don't think custom elements are completely useless. See the follow up for more details. Leaving this post as-is for posterity.

Update on Nov 18, 2023: Added CodePens for all code + slight…

naildrivin5.com - David Bryant Copeland's Website 

Appearance on Software Sessions Podcast

Jeremy Jung had me on his podcast during RubyConf this past week. It was a great conversation. We talk about choosing technology, Go vs Ruby, moving from Heroku to AWS and more!

naildrivin5.com - David Bryant Copeland's Website 

Web Components Custom Elements Lifecycle is What Makes Them Useful

Feedback from my previous post on Web Components was that the lifecycle callback methods like connectedCallback are actually what makes custom elements useful. After exploring this more, I can see why and want to demonstrate.

The examples in my previous post demonstrated progressive enhancement for a server-rendered page. I anchored to this as that was the crux of Jim Neilsen’s blog post, and a lot of discussion around Web Components is how they can support progressive enhancement. In that scenario, the callbacks on a custom element don’t seem useful.

But, as was pointed out to me a few times on Mastodon and email, these callbacks vastly simplify managing dynamic insertion of…

Andy Croll 

For clarity merging hashes use with_defaults

Rails is known for adding methods to existing core Ruby classes for improved readability via Active Support. One such example is the with_defaults method on Hash. This method is an alias of another added method reverse_merge, which should give you a clue as to how it works.

As you can see in the source code, the implementation is fairly straightforward.

Instead of…

…using Hash#merge when adding defaults…

user_provided = {q: "Andy", age: 44, limit: 1}

listing_options = {order: "asc", limit: 25}.merge(user_provided)
#=> {:order=>"asc", :limit=>1, :q=>"Andy", :age=>44}

Use…

…the #with_defaults method.

user_provided = {q: "Andy", age: 44, limit: 1}

listing_options = user_provided.with…
a-chacon 

💎Ruby Tip💎 Interactive debugging without the need to install gems.

Discover a simple and fast way to debug in Ruby without installing additional gems. With the Binding class and the integrated IRB console, you can explore and modify the execution context to resolve errors efficiently.
naildrivin5.com - David Bryant Copeland's Website 

Web Components Custom Elements Lifecycle is What Makes Them Useful

Feedback from my previous post on Web Components was that the lifecycle callback methods like connectedCallback are actually what makes custom elements useful. After exploring this more, I can see why and want to demonstrate.

The examples in my previous post demonstrated progressive enhancement for a server-rendered page. I anchored to this as that was the crux of Jim Neilsen’s blog post, and a lot of discussion around Web Components is how they can support progressive enhancement. In that scenario, the callbacks on a custom element don’t seem useful.

But, as was pointed out to me a few times on Mastodon and email, these callbacks vastly simplify managing dynamic insertion of…

naildrivin5.com - David Bryant Copeland's Website 

Appearance on Software Sessions Podcast

Jeremy Jung had me on his podcast during RubyConf this past week. It was a great conversation. We talk about choosing technology, Go vs Ruby, moving from Heroku to AWS and more!

Posts on Kevin Murphy 

RubyConf 2023 Recap

RubyConf 2023 🔗

RubyConf recently wrapped up in San Diego, California. 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.

Preparing 🔗

If you’d prefer, you can skip right to my commentary on the start of the conference.

This is a weird brag, but this is the first conference I’ve attended in a long time as an attendee. It’s been a while since I haven’t been a speaker or on the speaker waiting list. Being a wait-listed speaker means you prep and have a talk ready. You only get to give it if you need to substitute…

naildrivin5.com - David Bryant Copeland's Website 

What is WebComponents Buying Us?

People saying that “Web Components are having a moment” should look at the difference between Web Components and just using the browser’s API. They are almost identical, so much so that I’m struggling to understand the point of Web Components at all.

Let’s take Jim Neilsen’s user avatar example and compare his implementation to one that doesn’t use Web Components. This will help us understand why there is so much client-side framework churn.

Update on Nov 19, 2023: Based on reader feedback, I don't think custom elements are completely useless. See the follow up for more details. Leaving this post as-is for posterity.

Update on Nov 18, 2023: Added CodePens for all code + slight…

OmbuLabs Blog 

Running Airflow on Google Kubernetes Engine without Helm

Google Cloud Platform (GCP) can be a very good option for Airflow and, although it offers its own managed deployment of Airflow, Cloud Composer, managing our own deployment gives us more granular control over the underlying infrastructure, impacting choices such as what Python version to run and even when to upgrade Airflow itself.

The Airflow community maintains a Helm chart for Airflow deployment on a Kubernetes cluster. The Helm chart comes with a lot of resources, as it contains a full Airflow deployment with all the capabilities. We didn’t need all of that, and we wanted granular control over the infrastructure. Therefore, we chose not to use Helm, although it provides a very good…

Dhaval Singh's Blog 

What the pluck?

ActiveRecord is a great ORM, with a ton of nifty little things that make your life easy when dealing with DB queries. pluck is one such method. I've been using pluck for as long as I can remember, and even my second oldest article is on it!

Even after using it for so long, recently I found myself debugging a relatively simple query that used pluck and realized I missed some key points regarding this sweet little AR method. docs meme

The Rails Guides on pluck is pretty neat, but there are still some things you might miss so I'll try to sum it all up here. If you're just starting out or might have overlooked the documentation, I highly recommend going through this. However, if you're already versed…

Ruby on Rails 

Action Mailer bug report template, Active Storage fixes and more!

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

Fix word_wrap with empty string
This pull request fixes word_wrap to return an empty string instead of nil when given an empty string.

Process preview variant when processing preview
This pull request updates ActiveStorage::Preview#processed to generate both the full-sized preview image and the requested variant. For example, attached_pdf.preview(:thumb).processed will now immediately generate the full-sized preview image and the :thumb variant of it. Previously, the :thumb variant would not be generated until a further call to e.g. processed.url.

Fix TransformJob not accepting previewables
The ActiveStorage::Transfo…

zverok's space 

Language, perception, and empathy: Ukrainian's gaze (Notes to the talk rejected by RubyConf)

This week, I am breaking the flow of my “Useless Ruby sugar” article series for a text that would be quite different.

This week, the largest US Ruby conference, RubyConf, was held in San Diego. When, a few months ago, its call for papers was announced, I suddenly had an idea for a talk that seemed quite interesting: the talk that would be drawn both from my experience of Ukrainian living through war and my experience as a long-term dedicated Rubyist, part of the core team and a maintainer of Ruby Changes/Ruby Evolution.

Obviously, I knew I wouldn’t be able to attend a conference in the US to give a talk in person, so I wrote to organizers asking whether it would be possible to consider—as…

Remote Ruby 

Rails World 2023 Recap & Rails Foundation Plans with Amanda Perino

In this episode, Jason, Chris, and Andrew welcome guest, Amanda Perino, Executive
Director from the Rails Foundation. Today, they discuss their experiences at Rails
World, touching on the importance of community enthusiasm and the benefits of in-
person events. Amanda shares how the Rails Foundation coordinated Rails World and
managed feedback, with a special mention of the EventStack team. They highlight the
custom design elements of the conference and the speaker experience. Amanda
emphasizes the significance of having a strong team, and they discuss the decision to
host the next Rails World 2024 in Toronto and the potential for future rotations to diverse
regions. There’s also a conversation…

All about coding 

Ruby open source: feedbin

The product

https://feedbin.com

"Feedbin is the best way to enjoy content on the Web. By combining RSS, and newsletters, you can get all the good parts of the Web in one convenient location"

Open source

The open-source repository can be found at https://github.com/feedbin/feedbin

License

The license they use is MIT:

Technical review

Ruby and Rails version

They are currently using:

Architecture

Code Architecture:

  • They are using the standard Rails organisation of MVC.

Database:

  • The DB is…
Giant Robots Smashing Into Other Giant Robots 

The Ruby devroom is back at FOSDEM

Yours truly has written an application for a Ruby devroom at FOSDEM2024 and the organizers were gracious enough to give it! It has been 6 long years since Ruby got a room at FOSDEM, so it’s a merry thing for our community to have it back.

I invite you all, beginners as well as veterans, to give a talk. This is the ruby call for participation.

FOSDEM will be held the weekend of the 3rd and 4th of February in Brussels, Belgium. The Ruby devroom will be open the Saturday afternoon. Having gone to FOSDEM a few times now, I can honestly say that it offers a lot throughout the weekend, even without a Ruby devroom. It’s better with one, needless to say.

Also, if you’re one of our blog readers,…

Awesome Ruby Newsletter 

💎 Issue 391 - YJIT Is the Most Memory-Efficient Ruby JIT

Ruby Weekly 

IRB adds type-based completions

#​678 — November 16, 2023

Read on the Web

Ruby Weekly

Ruby 3.3.0 Preview 3 Released — With just 39 days till Christmas and Ruby 3.3, it’s time for another preview release. 3.3.0-preview3 retains all the prior 3.3 improvements like those to YJIT performance, but also introduces the M:N thread scheduler and the Prism Ruby parser (formerly YARP).

Yui Naruse

YJIT is the Most Memory-Efficient Ruby JIT — Shopify’s tireless work on YJIT has paid off in many ways, including a ~15% speed-up for their storefronts. The team’s methodology on benchmarks, however, goes beyond performance to warm-up time and memory…

Saeloun Blog 

Integrate Google Calendar API into rails application

Google Calendar is a widely used tool that helps millions of people stay organized and on top of their schedules.

By incorporating its powerful API into our Rails application, we can unlock a wealth of functionality that empowers us to seamlessly synchronize events, create new appointments, and even automate reminders.

In this blog post, we’ll explore the step-by-step process of integrating the Google Calendar API into our Rails application.

To integrate the Google Calendar API into our rails application first, we’ll need to install the google-api-ruby-client gem.

Add it into the Gemfile -

  gem 'google-apis-calendar_v3'

After adding it in the Gemfile run bundle install in the console…

All about coding 

Ruby on Rails projects that might inspire you to start your own

I discovered this Reddit thread on /r/rails and I thought it would be a good idea to pick some of the things posted there in an article and also share it on my social media channels.

So the question they asked there was the following:

Anyone here use Rails to start their own business?

Here are some answers that I picked from there.

airnoise.io

"The fast, easy way to file airport noise complaints"

His creator describes it as:

"Its been live for over seven years. Ive got several thousand users and the system has processed over 15 million noise complaints. Its mainly hosted on Heroku and AWS though Im investigating using Kamal to Dockerize everything to run it more cheaply. It still pays for itself, though. My biggest issue is simply updating the app to the latest Rails version, which would have been easier incrementally but here we are! Whatever your idea  just build it and launch it. If you know Rails, use that. Do not agonize over whether or not its the perfect or even best platform, just build the damn thing and the rest will work itself out. Dont wait. Start now. And have fun!"

I want to add here that by looking at what people share online, the upgrades are easier and easier. Also now Shopify and Github along with Basecamp are I think running on Rail's main branch so the upgrade should be way easier

saashub.com

"Software Alternatives And…

Posts on Kevin Murphy 

Ruby Friends at RubyConf 2023

Ruby Friends at RubyConf 2023 🔗

RubyConf 2023 just wrapped up. It was a pleasure meeting everyone and learning from you all. I took far too few photos, and mostly remembered to take pictures with people on the last day. With no further ado, here are the #RubyFriends pictures I took in San Diego.

In any pictures that feature more than one other person, I’ll list them from left to right as they appear in the photo. Also, I’m terrible at taking pictures. Sorry everyone.

Joël Quenneville and me at RubyConf 2023

Joël Quenneville gave a great talk right after the keynote to start the conference talk sessions. It’s so great to see him. More often than not we have to travel across the country to do so.

Daniel Magliola, Paul Reece, and me at RubyConf 2023

Daniel Magliola is a friend I’m so…

John Nunemaker 

Indie Rails Podcast

I did a podcast interview with Jeremy and Jess from IndieRails. We talked through a lot of past and a little future – from my first website to plans for Flipper Cloud.

I love podcasts like this because you really get to know the hosts. On every one of them, I end up with new friends. The talking before we hit record and after we stopped was some of the best stuff 😉 but you'll have to trust me on that.

Head on over to their site and give it a listen.

Test Double 

How GitHub Actions can turn your code into a Docker daemon

So let’s say that you have a shiny new Ruby program that you wrote. But how will you ensure every environment has the right version of Ruby installed and every user knows how to install all of its dependencies? Before you answer that yourself, ask the lead maintainer of Homebrew how much fun he’s having.

I think there is a simpler method to this madness. This is a tutorial to automatically build and push container images for your project, which will save you time and minimize tedious tasks. Manual process is for people that don’t yet realize how much time you can save yourself by using DevOps principles to automate this tedious work. The pattern in this post will work for a variety…

Aha! Engineering Blog 

More feedback! Quantity becomes quality

In David Bayles and Ted Orland's book, Art & Fear, there's a captivating story that has always stuck with me. This is a story that highlights a timeless argument: quantity versus quality. It goes like this:

"[A] ceramics teacher announced on opening day that he was dividing the class into two groups. All those on the left side of the studio would be graded solely on the quantity of work they produced, while those on the right would be graded solely on its quality...

Well, came grading time and a curious fact emerged: the works of highest quality were all produced by the group being graded for quantity. It seems that while the 'quantity' group was busily churning out piles of work — and…

This story isn't just about art. It's a lesson that extends to the…

Saeloun Blog 

Rails 7.1 Adds Support for MessagePack as Message Serializer

In Rails 7.1, support for MessagePack has been added, and it can be used with MessageEncryptor and MessageVerifier. config.active_support.message_serializer will also accept :message_pack and :message_pack_allow_marshal as serializers.

What is MessagePack?

MessagePack is an efficient binary serialization format that enables the exchange of data among multiple languages, similar to JSON.

It is faster and more compact compared to JSON, as it is optimized for binary data serialization. Specifically designed for efficiently representing complex data structures, it makes the payload smaller and faster to serialize and deserialize.

The following is a message serialized by MessagePack:

require
Ruby Magic by AppSignal 

Handle Incoming Webhooks with LiteJob for Ruby on Rails

In parts one and two of this series, we only dealt with the pure CRUD aspects of using SQLite as a production database.

In this post, we will explore the world of queue mechanisms, using SQLite as the pub/sub adapter for ActiveJob.

Let's make use of LiteJob to handle incoming webhooks in our Rails application.

Our Ruby on Rails Use Case

Our use case is the image generation that we are currently doing synchronously in the PromptsController:

model = Replicate.client.retrieve_model("stability-ai/stable-diffusion-img2img")
version = model.latest_version
version.predict({prompt: prompt_params[:title], image: @prompt.data_url}, replicate_rails_url)

Clearly, there are some long-running processes…

Write Software, Well 

How to Customize Rails Validation Errors to Remove Leading Attribute Column Names

How to Customize Rails Validation Errors to Remove Leading Attribute Column Names

Let's consider the following model in Rails:

class Post < ApplicationRecord
  validates :title, presence: true
end

When Rails runs the validations while creating or updating the post record, if the title attribute is missing, Rails will add the following error message to the model: "Title can't be blank".

Specifically, Rails inserts the column name (attribute) at the beginning of the error message.

You can customize this error by passing the message option to the validation:

validates :title, presence: { message: "must be provided" }

This results in the following error message: "Title must be provided".

What if you don't want the column name "Title" at the start of the error message? This might…

BigBinary Blog 

Deep Dive into Redis Data Types

Last week while migrating neetoGit'sproduction deployment to neetoDeploy, wefaced a challenge. Redis 7 addon only had TLS url in Heroku. We were not able toget the dump in a straightforward manner using redis-cli, since we didn't haveaccess to the certificates for making a TLS connection. We were able to connectto the addon, so we decided to write a script to manually copy all the keys andvalues over to the Redis addon in neetoDeploy.

While writing the program we realized that we'd need a switch-case that checkedwhat data type each key was. We had to search for the get and set methods foreach data type manually while writing the program. Later we used the redis-rbgem and was able to get the…

Evil Martians 

Freezolite: the magic gem for keeping Ruby literals safely frozen

Authors: Vladimir Dementyev, Principal Backend Engineer, and Travis Turner, Tech EditorTopics: Backend, Performance Audit and Optimization, Ruby, Ruby on Rails

Introducing the freezolite gem, which helps enable frozen string literals by default in Ruby projects on a per-folder basis.

Once upon a time, a question was raised in the #backend channel of the Evil Martians Slack. “Is there a way to magically set frozen_string_literal to true for an entire project to silence that annoying comment in every Ruby file? It's seriously frustrating, and RuboCop keeps bugging me as I'm always forgetting it somewhere!“ Sounds familiar? Read on and learn about the Freezolite gem, a concoction crafted up to…

Julia Evans 

Some notes on nix flakes

I’ve been using nix for about 9 months now. For all of that time I’ve been steadfastly ignoring flakes, but everyone keeps saying that flakes are great and the best way to use nix, so I decided to try to figure out what the deal is with them.

I found it very hard to find simple examples of flake files and I ran into a few problems that were very confusing to me, so I wanted to write down some very basic examples and some of the problems I ran into in case it’s helpful to someone else who’s getting started with flakes.

First, let’s talk about what a flake is a little.

flakes are self-contained

Every explanation I’ve found of flakes explains them in terms of other nix concepts (“flakes…

Greg Molnar 

Open redirect vulnerabilities in Rails apps

Today, I want to tell you about open redirect vulnerabilities and how to prevent them in a Rails application.

Radan Skorić's personal site 

Preventing bugs in Ruby: tools of the trade

Intro Bugs are an inevitable part of complex software and aiming for complete bug-free perfection is not only unrealistic, but it hinders progress and product delivery. David Heinemeier Hansson, creator of Ruby on Rails Ruby is optimised for programmer happiness. Yukihiro Matsumoto, creator of Ruby I completely agree with both of the above statements, but still my personal happiness ...
Saeloun Blog 

Rails 7.1 Introduces ActiveRecord::Base::generates_token_for

With ActiveRecord::Base.generates_token_for we can generate tokens for specific purposes and verify their authenticity. This feature simplifies the process of generating and validating tokens, enhancing the security and user experience of our application. Can be used to implement features like password reset, email confirmation, and other features that require single-use tokens.

generates_token_for takes these below arguments:

  • Purpose (Symbol or String) as the first argument, which is used to distinguish between different types of tokens in our application. The purpose helps us categorize and manage tokens for various use cases, such as authentication, email confirmation,…

Ruby Rogues 

Minimalist Frameworks: Embracing Simplicity and Efficiency in Modern Web Development - RUBY 613

Charles and Valentino join this week's panelist episode. They dive into the world of Ruby and explore the latest advancements in building tools and frameworks. They discuss the popularity of tools, questioning if they are truly necessary. They also delve into the benefits of a minimalist approach to frameworks and the challenges of defining boundaries in app development.


Sponsors




Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy
Stanko Krtalic Rusendic 

Tracking online presence with ActionCable

This month I worked on tracking when a device connected and disconnected to a WebSocket backed with ActionCable. At first, this seemed like a simple problem to solve, but it turned out to be much more complicated.

I started with a simple solution, which was to mark a Device as being online in the #subsribed method, and marking it as offline in the #unsubscribed method. These methods are called when a client subscribes or unsubscribes to a channel. This is also the solution from the ActionCable guides.
#!/usr/bin/ruby

class EventsChannel < ApplicationCable::Channel
  def subscribed
    Current.device.came_online
    stream_from Current.device
  end

  def unsubscribed
   …
The Bike Shed 

406: Working Solo

Joël got to do some pretty fancy single sign-on work. And when it came time to commit, he documented the ridiculous number of redirects to give people a sense of what was happening. Stephanie has been exploring Rails callbacks and Ruby debugging tools, using methods like save_callbacks and Kernel.caller, and creating a function call graph to better understand and manage complex code dependencies.

Stephanie is also engaged in an independent project and seeking strategies to navigate the challenges of solo work. She and Joël explore how to find external support and combat isolation, consider ways to stimulate creativity, and obtain feedback on her work without a direct team.…

Notes to self 

Business Class 1.2 with Rails 7.1, Tailwind, and GoodJob

Business Class 1.2 is here just in time for Black Friday.

Tailwind

The first big change is switching from Bulma to Tailwind. Bulma is not innovating and became extremely unpopular while latest Tailwind fixed some issues I had with it. Tailwind’s @apply allowed me to convert the base theme to Tailwind while also reducing the overall markup. You can still change the whole theme within a single file while having the flexibility to copy & pasting Tailwind components.

GoodJob

Times are shifting with the latest Rails World announcements of Solid Queue and GoodJob is the stable answer for Redis-free background job processing on PostgreSQL. New projects usually don’t require Sidekiq level of…

Short Ruby Newsletter 

Short Ruby News - Edition #67

Discover the world of Ruby in this comprehensive newsletter covering week 45 of 2023. Find code samples, community updates, gems, resources, and thought-provoking discussions.
Ryan's Dev Blog 

RailsCasts Retrospective Part 2: The Fire

This is the second installment of a three-part series telling the story of RailsCasts, a screencast series for Ruby on Rails. Check out Part 1 if you haven't already.

Reaching an Audience

Two months after the first RailsCasts episode, I attended RailsConf 2007. I'd never been to RailsConf before and was eager to meet fellow Rails developers. This one was in Portland, Oregon which was only a few hours drive. The conditions were perfect.

I remember eating lunch and talking casually among developers around a table. Are you Ryan Bates? asked one sitting next to me, I recognize your voice. Several others at the table chimed in and said they also watched RailsCasts.

It was a surreal feeling being…

Evil Martians 

Figma plugin API: diving into advanced algorithms & data structures

Authors: Yuri Mikhin, Frontend Engineer, and Travis Turner, Tech EditorTopics: Frontend, Full Cycle Software Development, Figma, TypeScript, React, Accessibility

When developing a Figma plugin, one may encounter issues not covered by the official documentation. For example, making Polychrom, a supercharged UI-text readability plugin, needed innovative solutions, like applying algorithms and tree traversal techniques. This is the kind of post you read to think “outside the docs”.

When developing a Figma plugin, one may encounter issues not covered by the official documentation. This happened to us while making Polychrom, a (soon-to-be renowned) UI-text readability plugin. In our case, we had…

Write Software, Well 

How to Return 404 Not Found Error in Rails

How to Return 404 Not Found Error in Rails

The other day, I wanted to display a helpful web page when some resource was missing in my Rails app, and realized that I don't really understand how 404 Not Found errors work, especially how to return them from Rails. After a few hours of deep diving into HTTP and Rails documentation, and reading up on Google's SEO guidelines, here's everything I learned about 404 Not Found and how you can work with them in Rails.

Let me know in the comments if I missed something important.

What is a 404 Not Found Error?

Every webpage is a file on a computer somewhere. For static websites, it's literally a file, but for dynamic web applications, it's a file that the server program (Rails / Laravel, etc.)…

Test Double 

The future of Rails test data management

One year ago last week, I wrapped up work on a Ruby gem called test_data that aims to be a more robust alternative to Rails’ rather-limited database fixtures. It also stands in sharp contrast to factory_bot, the design of which has led countless developers to tie their test suites into very slow, very confusing knots.

I iterated on test_data’s basic design in meetings and on whiteboards for years before I broke ground. Once I started coding, I couldn’t stop. I worked tirelessly to cover every edge case. I plugged it into several of my own apps to prove that it imbued the benefits I thought it would: dramatically simpler test code and gobsmackingly-fast runtime performance. And then I…

Petr Hlavicka 

Gem Credentials Management with Gemstash

How can we efficiently manage gem credentials across the team?
Ruby News 

Ruby 3.3.0-preview3 Released

We are pleased to announce the release of Ruby 3.3.0-preview3. Ruby 3.3 adds a new parser named Prism, uses Lrama as a parser generator, adds a new pure-Ruby JIT compiler named RJIT, and many performance improvements especially YJIT.

Prism

  • Introduced the Prism parser as a default gem
    • Prism is a portable, error tolerant, and maintainable recursive descent parser for the Ruby language
  • Prism is production ready and actively maintained, you can use it in place of Ripper
    • There is extensive documentation on how to use Prism
    • Prism is both a C library that will be used internally by CRuby and a Ruby gem that can be used by any tooling which needs to parse…
Ruby on Rails 

Rails 7.1.2 has been released!

Hi everyone,

I am happy to announce that Rails 7.1.2 has been released.

CHANGES since 7.1.1

To see a summary of changes, please read the release on GitHub:

7.1.2 CHANGELOG To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as…

Julia Evans 

How git cherry-pick and revert use 3-way merge

Hello! I was trying to explain to someone how git cherry-pick works the other day, and I found myself getting confused.

What went wrong was: I thought that git cherry-pick was basically applying a patch, but when I tried to actually do it that way, it didn’t work!

Let’s talk about what I thought cherry-pick did (applying a patch), why that’s not quite true, and what it actually does instead (a “3-way merge”).

This post is extremely in the weeds and you definitely don’t need to understand this stuff to use git effectively. But if you (like me) are curious about git’s internals, let’s talk about it!

cherry-pick isn’t applying a patch

The way I previously understood git cherry-pick…

AkitaOnRails.com 

[Akitando] #147 - Criptografia na Prática - Certificados, BitTorrent, Git, Bitcoin

Como que se geram chaves secretas pra encriptação? Pra que servem pares de chaves? Como certificados funcionam? Qual a diferença de impressão digital e assinatura digital? Como tudo isso funciona junto e chega em coisas como BitTorrent, Git ou Bitcoin?

Já tinha feito 2 videos falando do básico de criptografia, hoje é dia de ver como essas coisas funcionam na prática e são usados em aplicações de verdade.

Capítulos

  • 00:00:00 - Intro
  • 00:01:28 - CAP 1 - Criptografia Simétrica - OpenSSL
  • 00:10:11 - CAP 2 - Criptografia Assimétrica - Chaves RSA
  • 00:17:06 - CAP 3 - Certificados Digitais - Let's Encrypt
  • 00:29:18 - CAP 4 - Impressões e Assinaturas Digitais - Hashing
  • 00:38:54 - CAP 5 - Picotando…
zverok's space 

“Useless Ruby sugar”: Keyword argument and hash values omission

This is a part of a blog post series about “useless” (or: controversial) syntax elements that emerged in recent Ruby version. The goal of the series is not to defend (or criticize) the features, but to share a “thought framework” for analysis of their reasons, design, and effect the new syntax has on a code that uses it. See also intro/ToC post.

Today’s topic is a small one, yet, nevertheless, the one that invoked a lot of mixed feelings: an ability to omit hash1 or keyword argument values.

What

Since Ruby 3.1, this code works:

x = 5
# Constructing a hash
h = {x:}  # same as `h = {x: x}`
#=> {x: 5}

def distance_to(x:, y:)
  # ...
end

# Implicitly passes `x: 5`
distance_to(x:, y: 10

This works for any locally-available name, like methods and constants, too:

def m = "method result"
C = 3

{C:, m:}
# {:C=>3,…

Why

The…

Remote Ruby 

Turbo Morph & ActiveRecord Encryption with Jorge Manrubia

In this episode, Jason and Chris welcome guest, Jorge Manrubia, a Lead Programmer at 37signals in Spain known for his contributions to Ruby on Rails.  Today, Jorge shares insights into his background, role at 37signals, and contributions to open source projects.  He discusses his experiences, including the importance of learning from rejection and the value of experience in job interviews.  The conversation dives into Jorge’s work on Active Record Encryption and Console1984, and Jorge touches on the development of Turbo, with a particular focus on enhancing user interface fidelity in calendar applications using morphing. Also, they discuss the challenges of using Turbo Streams for complex…

Ruby on Rails 

YJIT enabled by default, Active Model improvements and much more

Hi, it’s Wojtek. This week, the documentary movie about the origins of Ruby on Rails premiered. You can see it on the Honeypot YouTube channel. Now, let’s explore this week’s changes in the Rails codebase.

Enable YJIT by default if running Ruby 3.3+
There was many public reports of 15-25% latency improvements for Rails apps that did enable Ruby 3.2 YJIT, and in 3.3 it’s even better. Following the change, in Ruby 3.3 YJIT is paused instead of disabled by default, allowing us to enable it from an initializer.

Make the output of Active Records inspect configurable.
One can use attributes_for_inspect method:

Post.attributes_for_inspect = [:id, :title]
Post.first.inspect #=> "#<Post id: 1,…

With the attributes_for_inspect set…

All about coding 

Ruby Open Source: chatwoot

Continuing the series about open-source Ruby with chatwoot

As a reminder, this is a 30-minute review so this is a high-level overview and there might be things that I missed or that I misunderstood.

The product

chatwoot is an "Open-source customer engagement suite, an alternative to Intercom, Zendesk, Salesforce Service Cloud etc"

What is chatwoot from their website

The interface looks like this (source their website)

an example of chatwood main interface

They were part of YCombinator batch in 2021.

Open Source

Repository and License

The repository is on Github at https://github.com/chatwoot/chatwoot and it is open sourced with a license that seems a variant of MIT license:

Ruby and Rails version

At the moment of writing this article (November 2023), it runs…

RubyGems Blog 

3.3.27 Released

RubyGems 3.3.27 includes bug fixes.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Bug fixes:

  • Provide fix for bundler Gemfile resolving regression. Pull request #6717 by Hiroshi SHIBATA.

SHA256 Checksums:

  • rubygems-3.3.27.tgz
    dc821bf2a416e9c25a964181a83439209b3ae81cfca1632733ca04da946c0fbd
  • rubygems-3.3.27.zip
    11e5cdbb347c0540d28723814b8ea84deb7151f8de1cddbe48a1466a13d0db60
  • rubygems-update-3.3.27.gem
    46cc13e192feb17fb74ce4cdd354154450533ab2844af842381c2d99c5cd45cb
Ruby Changes 

Ruby Evolution

naildrivin5.com - David Bryant Copeland's Website 

Fan-out Sidekiq Jobs to Manage Large Workloads

Performing a resilient operation on bulk data can be challenging, especially if the operation relies on a third party. You can safely do this by fanning out the work to idempotent background jobs that operate on only one piece of data at a time. Those jobs can retry independently as needed, making the entire operation more easy to manage. This post will show an example of how that works and why you might want to use this pattern.

Fanning out is a way to perform work in parallel batches instead of inside a loop. Executing an operation this way provides more control and more resilience. Doing this well requires a combination of both job and database design.

Simple Domain of Charging…

Awesome Ruby Newsletter 

💎 Issue 390 - See the History of a Method with git log -L

Ruby Weekly 

Rails: The Movie

#​677 — November 9, 2023

Read on the Web

Ruby Weekly

▶  Ruby on Rails: The Documentary — Skip Netflix and enjoy this well produced 45-minute documentary going into the history of Rails (including the infamous 'F— You' slide) and DHH's relationship with the project and the community. A few other folks pop up to flesh out the story and we get to see a six-year old DHH! If you prefer to read, don't worry – we're told a written version will be available shortly.

Honeypot

💡 If you like this sort of documentary, a recently released ▶️ TypeScript origins documentary was also fantastic, even if you're not a…

Should I Add…

ruby – Bibliographic Wilderness 

Beware sinatra, rails 7.1, rack 3, resque bundler dependency resolution

tldr practical advice for google: If you use resque 3.6.0 or less, and Rails 7.1, and are getting an error: cannot load such file -- rack/showexceptions — you probably need to add rack "~> 2.0" to your Gemfile!


The latest version of the ruby gem sinatra, as I write this, is 3.1.0, and it does not yet support the recently released rack 3. It correctly specifies that in it’s gemspec, with gem "rack", "~> 2.2", ">= 2.2.4

  • [And as of this writing, that is true in sinatra github main branch too, no work has been done to allow rack 3.x]

The new Rails 7.1 does work with and allow Rack 3.x, as well as still working with Rack 2.x, it allows any rack >= 2.2.4 (specifying it will be…

RubyGems Blog 

3.4.22 Released

RubyGems 3.4.22 includes enhancements, bug fixes, performance and documentation.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Enhancements:

  • Update SPDX license list as of 2023-10-05. Pull request #7040 by github-actions[bot]
  • Remove unnecessary rescue. Pull request #7109 by deivid-rodriguez
  • Installs bundler 2.4.22 as a default gem.

## Bug fixes:

  • Handle empty array at built-in YAML serializer. Pull request #7099 by hsbt
  • Ignore non-tar format .gem files during search. Pull request #7095 by dearblue
  • Allow explicitly uninstalling multiple versions of same gem. Pull request #7063

## Performance:

  • Avoid regexp match on every call to Gem::Platform.local. Pull request #7104 by segiddins

## Documentation:

  • Get Gem::Specifica…
Write Software, Well 

Interview with Daniela Baron, Staff Engineer at FundThrough

I've never felt more productive or happy than when working with Ruby on Rails. Compared to other frameworks, my experience has been that Rails lets me quickly get to solving the business problems, without having to spend much time on lower level details and re-inventing the wheel. - Daniela
Interview with Daniela Baron, Staff Engineer at FundThrough

Welcome to the new series on this blog where I interview noteworthy Ruby and Rails developers, especially those who have made significant contributions to the community with their code, writing, or leadership.

In this second post in the series, I interviewed Daniela Baron, a Rails developer who is working as a staff engineer at FundThrough, a leading fintech company in Toronto, Canada. I first came across…

Ryan Bigg's Blog 

Ruby 3, Hashes and Keyword Arguments

We debugged a fun one today.

There’s a method provided by Rails called tag, and it provides a way to write HTML tags.

We were using it like this:

def react_component(component_name, props, options = {})
  tag.div({
    data: {
      react_component: component_name,
      props: props.to_json,
    }
  }.merge(options)) { "" }
end

Did you spot the bug? We didn’t for a while. The symptom was that we were seeing completely blank <div></div> tag, when we were expecting them to have at least the data attributes populated.

The issue here has to do with how Ruby 3 has changed how it processes keyword arguments. In Ruby 2.7, the argument passed to react_component was interpreted as keyword…

Depfu 

Depfu now supports pnpm

tldr: Depfu launched a beta version of pnpm support that should work for most people using pnpm. If you find any issues, please let us know.

We’ve had requests to support pnpm for a long time and we finally got around to implementing it. Deciding to support a new package manager, even if adjacent to existing implementations is always tricky. On one hand, you would think that it instantly grows our audience, at least when it is a popular choice. On the other hand, every package manager is a new breeding ground for bugs and their gentler sisters, edge cases.

For us, one deciding factor is the adoption outside of open source projects. While having Depfu available for free for open source…