Sign up for my newsletter

Let's learn to become better developers.

Let's Build a Web Application in Ruby without Rails

Rails is great for building web apps. But it can be quite overwhelming if you don't know how web applications work. In this series of articles, we'll build a simple but complete app in plain Ruby without Rails, to get a deeper understanding and appreciation of everything Rails does for us.

March 04, 2024

Let's Build a Web Application in Ruby without Rails

What Does the Frozen String Literal Comment Do in Ruby?

Frozen strings not only prevent unintended modifications, but also reduce the overhead of the garbage collector by eliminating unnecessary memory allocations, thus improving application performance. This post explains the concept of freezing along with the magic comment frozen_string_literal.

March 01, 2024

What Does the Frozen String Literal Comment Do in Ruby?

Speed Up Your Tests Using VCR Gem in Ruby

HTTP API requests can be slow. They're especially slow if you have to make them repeatedly in your tests. The VCR gem in Ruby speeds up your tests by recording the response the first time and replaying the same response for future runs. Let's understand how it works and how to use it.

February 23, 2024

Speed Up Your Tests Using VCR Gem in Ruby

Playing Sounds in Rails with the Audio API

In this post, we'll learn how Campfire allows users to play various funny sounds by typing `/play` followed by the name of the sound. I found the entire flow pretty interesting, involving various aspects of Rails and Hotwire. Let's see how it's done.

February 21, 2024

Playing Sounds in Rails with the Audio API

How to Generate Random Numbers in Ruby

This post covers the basics of random number generation in Ruby. As with everything in Ruby, there're multiple ways you could do it, with some approaches better than the other. We'll also explore generating random numbers in various formats as well as generating secure random numbers.

February 19, 2024

How to Generate Random Numbers in Ruby

Anonymous Block Forwarding in Ruby

In this post, we'll take a look at the anonymous block forwarding feature added in Ruby 3.1. It lets you replace your execute(&block) calls with execute(&). Not only it saves you from coming up with a variable (most likely blk), it also looks pretty sweet. I dig it.

February 14, 2024

Anonymous Block Forwarding in Ruby

Custom URL Helpers in Rails with the direct Method

This is the first post in the Campfire deep dive series where we explore the first ONCE product from 37signals to learn and extract useful patterns, ideas, and best practices. This post explores the direct method in the Rails Router that lets you define custom URL helpers for your application.

February 11, 2024

Custom URL Helpers in Rails with the direct Method

Understanding the Rails Router: Why, What, and How

The router is the entry point of your Rails application. It acts as the gatekeeper for all incoming HTTP requests, inspecting and sending them to a controller action; even filtering and rejecting them if necessary. In this article, we’ll do a deep dive into the Rails Router to understand it better.

February 05, 2024

Understanding the Rails Router: Why, What, and How

What is __FILE__ in Ruby?

You must have come across the mysterious term __FILE__ while reading Ruby code. It's a magic variable that returns the name of the current file. This short post shows a few different use cases that I found while reading the Rails source code.

February 03, 2024

What is __FILE__ in Ruby?

Prevent Logging Sensitive Data with Rails Parameter Filters

This article explains why you shouldn't log confidential or user-identifiable information and how to filter it using parameter filtering in Rails. We'll also do a deep dive into the Rails source code to learn exactly how Rails implements parameter filters.

February 01, 2024

Prevent Logging Sensitive Data with Rails Parameter Filters