Skip to content
Write Software, Well
  • Services
  • Books
  • LinkedIn
  • Archive
  • About
Sign in Subscribe
When to Use the Length, Size, and Count Methods in Rails

Length, Size, and Count in Ruby and Rails: When to Use Which?

You can use the length, size, and count methods to find the number of elements in a collection. This post explores the difference between these methods and explains how you should choose which method to use according to the needs of your application.

5 min read
Miles Woodroffe, Technical Advisor and Fractional CTO

Interview with Miles Woodroffe, former Global CTO of Cookpad

Miles Woodroffe is a veteran Ruby & Rails developer who served as a Global CTO at Cookpad for many years and represents the company as a founding board member at the Rails Foundation. I recently had the pleasure to interview Miles, and he graciously provided very thoughtful and interesting answers.

Interview 8 min read
The Difference Between nil?, empty?, and blank? in Ruby

The Difference Between nil?, empty?, and blank? in Ruby

In Ruby, you can use nil? method to check if the object is nil. However, Ruby also provides empty? and there’s a blank? method in Rails. For a Ruby (or Rails) newbie, it can get quite confusing, it certainly did for me. This post explains which method to use when. Hope it simplifies things a little.

1 min read
DHH's Tweet on Martin Fowler's Refactoring Book

Refactoring: Improving the Design of Existing Code (My Notes and Highlights)

I recently re-read Martin Fowler's excellent book on refactoring. It's about improving the design and quality of your code in small steps, without changing external behavior. The book contains detailed descriptions of refactorings, with motivation, mechanics, and an example for each. A must-read.

book-notes 13 min read
Enable caching in development mode in Rails

What Happens When You Run Rails dev:cache Command?

You can enable caching in development mode by running the `rails dev:cache` command in terminal. Ever wondered what that command does, and how exactly does it tell Rails to start caching stuff in your application? Let's take a peek behind the curtain to see exactly what's going on.

Rails Internals 2 min read
Hash with Indifferent Access

How to Access a Ruby Hash with both String and Symbol Keys

Sometimes, you receive a Hash key as a method parameter or via user input, and you want to make the Hash understand that key as-is, without worrying if the key is a string or a symbol. ActiveSupport's `HashWithIndifferentAccess` class lets you accomplish this in a convenient way.

Rails Internals 2 min read
Debugging Rails Codebase

How to Debug and Step-Through Rails Codebase

Do you want to read the Rails source code for a deeper understanding of the framework, but feel intimidated by the sheer size of the codebase, or don't know where to start? Start with a specific feature, insert a breakpoint, and step through the method line-by-line. This article shows how.

Rails Internals 3 min read
No, not these cookies!

The Complete Guide to Working With Cookies in Rails

This post covers almost everything you need to know about HTTP cookies in the context of Rails. We'll explore what a cookie is, why we need it, how to set & get a cookie, how to restrict cookies to a particular domain/path, prevent JavaScript access, how to sign & encrypt cookies, and much more.

14 min read
Middleware Pipeline

Rails Middleware: (Almost) Everything You Need to Know

In this post, we'll learn almost everything about Rails middleware: what it is, why we need it, how it works, and why it's so important. We'll also learn how to create and test custom middleware in a Rails app. Finally, we'll extract logging functionality in its own middleware in a simple web app.

This article is for Members only

Rails Companion 11 min read
Hotwire

Let's Read the Turbo Source: What Happens When You Click a Link?

Reading the source code is one of the best ways to learn how a feature, framework, or a program works. In this post, we'll explore the source code of Hotwire's Turbo library to understand exactly what happens when you click a link. I hope you'll appreciate Turbo much more after this deep dive.

11 min read
Simplified map function in Ruby

Let's Implement the Map Method from First Principles

Those new to functional programming often wonder when to use higher-order functions (or blocks/procs/lambdas in Ruby). I did, too. In this post, we'll implement the map method from scratch, in turn gaining an intuitive understanding of higher-order functions and when to use them.

5 min read
Active Record Database Migrations Cheatsheet

Rails Database Migrations Cheatsheet

The database schema evolves continuously. Rails migrations is a powerful and flexible way to update the schema without dropping and re-creating the database. However, all this power and flexibility can be overwhelming. Here's a handy cheatsheet for most common migration operations.

11 min read

Page 8 of 17

Load More Something went wrong with loading more posts
  • Sign up
  • Homepage

© Write Software, Well 2025 - Powered by Ghost