Send Emails in Bulk with deliver_all_later

This year, Rails introduced a new method for ActionMailer called deliver_all_later. This feature simplifies enqueuing multiple emails for delivery through Active Job. Instead of sending each email individually, you can now enqueue a batch of emails, allowing them to be sent asynchronously when their respective jobs run.

Match HTTP Methods with current_page?

When building a Rails app, you often need to create navigation links that highlight the current page. However, Rails’ default current_page? helper only works with GET and HEAD requests. This can be problematic when dealing with forms or actions that use other HTTP methods like POST, PUT, or PATCH. This feature was introduced in this PR

Rails 8.1: Open Error Files Directly in Your Favorite Editor

Quick iteration and efficient debugging are crucial for productivity. One feature that has made its way into Rails 8.1.0 makes the debugging experience even smoother by allowing you to open the file that caused an error directly in your favorite editor — straight from the error page. No more manually searching for the file that triggered the issue.

Action View Cache Helpers in Rails

Caching is one of the key techniques to optimize the performance of web applications, and Rails makes it easy to implement caching with various built-in helpers. These helpers help us cache fragments, partials, or even entire views, significantly reducing the load on your server by storing previously rendered content and reusing it when needed.

How has_secure_password Works in Ruby on Rails

Securely handling user passwords is crucial; thankfully, Rails provides a straightforward and powerful method for password management with has_secure_password. This method ensures that passwords are never stored in plain text, making your applications more secure by default.

ActiveJob Continuations: Handling Jobs in Rails

When building applications that require long-running background jobs, interruptions and restarts are inevitable. Whether due to server restarts, manual interventions, or just the natural limitations of background job queues, you need a way to make sure jobs can resume from where they left off.

How *_was Method Works in ActiveRecord

Being able to detect changes in model attributes is often essential for building reactive, state-aware systems in Rails. Whether you’re logging updates, triggering side effects, or enforcing validations, it helps to know what a value used to be before it was changed.

Understanding Rails.error.report in Rails 7+

For Rails developers, understanding how to effectively handle and report errors is a critical skill. With the introduction of the Error Reporter API in Rails 7, a standardized and powerful mechanism for managing exceptions across your application has emerged.

Chaining Transformations with .then in Ruby

Have you ever found yourself writing a series of operations in Ruby that felt a bit too verbose? The then method, introduced in Ruby 2.6, is a clean and elegant way to chain transformations on a value, avoiding intermediate variables and improving code clarity.

Sanitizing HTML in Rails with strip_tags

In some API responses, it’s necessary to return plain text even when the original method outputs HTML. This can be challenging when the source method can’t be modified and the response format must follow strict requirements.

How to Exclude Inherited Fields in Rails Serializers

When working with ActiveModel::Serialization in a Ruby on Rails API, it’s common to organize serializers using inheritance—especially when building and maintaining different versions of your API.

A Quick Guide to Ruby's tally Method

Ruby 2.7 introduced a small but powerful method: tally. If you’ve ever written code to count how many times each item appears in a collection, you’re going to love this.

Simplify Nested Routes in Rails with shallow: true

When dealing with nested resources in Ruby on Rails, long and deeply nested URLs can quickly become a problem. That’s where the shallow option comes in.

Ruby's zip: A way to merge arrays

When you need to combine multiple arrays element by element in Ruby, the zip method is just what you need. It’s concise, expressive, and ideal for transforming structured data—especially when used with to_h or map.

Hash Transformations using index_by vs index_with

Rails provides expressive, concise tools for working with collections. Two often-overlooked but potent methods are index_by and index_with.

Understanding Ruby's Range Operator .. in ActiveRecord Queries

When working with date ranges or numeric intervals, the range operator .. (inclusive) is a powerful and clean tool. In this post, we’ll break down how it works and how to use it effectively in your database queries — along with a comparison to the more verbose alternative.

When to Use head vs render in Rails Controllers

In Ruby on Rails, controller actions usually return responses using render. However, in many cases—especially in APIs—you only need to return an HTTP status code without a response body. That’s exactly what head is for.

Ensuring Unique Records with find_sole_by in Ruby

The method find_sole_by is particularly useful when you need to retrieve a single record based on a condition but want to ensure that only one matching record exists. If more than one record is found, it raises an exception, helping you catch potential data issues early.

Fixing Encoding Issues in Ruby with String#scrub

When working with data in Ruby, especially when processing user input or reading from external sources, it’s common to come across strings that contain invalid or corrupted characters. This can happen due to encoding issues or poorly formatted input. Thankfully, Ruby offers a built-in method called String#scrub to handle these cases cleanly and efficiently.

find_each vs find_in_batches in Active Record

When working with large datasets in Rails, loading all records into memory can be expensive and inefficient. That’s where Active Record’s batch processing methods — find_each and find_in_batches — come to the rescue. They allow you to iterate over large numbers of records without blowing up your memory usage.

Improving Rails Migrations Using bulk: true

When working with Rails migrations, performance isn’t usually the first thing that comes to mind—until your schema starts getting big or you’re deploying changes to production environments with large databases. Fortunately, Rails provides a simple way to optimize schema changes: the bulk: true option.

Hiding Unfinished Features in Rails

When working on a new feature that’s not quite ready for production, it’s helpful to hide it without introducing a bunch of complexity or new dependencies.

Clean Strings Efficiently with delete_suffix and delete_prefix

Ruby provides many powerful methods for string manipulation, and among them, delete_suffix and delete_prefix are particularly useful when dealing with structured text. These methods allow you to remove a specified suffix or prefix from a string if it exists, providing a clean and efficient way to handle text processing.

Make or Zapier? Choosing the Best Workflow Automation Tool

When comparing Make and Zapier, both are powerful automation tools that connect various apps and automate workflows, but they cater to different needs and preferences, especially in terms of complexity, flexibility, and pricing.

Boost Your Coding Efficiency: 10 AI Tools for Developers

In the fast-paced world of software development, artificial intelligence is changing the way developers write code. AI tools designed to assist with everything from code completion to bug detection make it easier than ever to boost productivity, enhance code quality, and improve overall workflow. In this post, we’ll review 10 popular AI tools for “vibe” coding.