Origin of ActiveRecord

As a long-time Ruby on Rails programmer, I thought that the name ActiveRecord –the model layer of Rails’ MVC– was branding. I didn’t know that it’s an architectural pattern, described by Martin Fowler in the 2003 book Patterns of Enterprise Application Architecture. An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data. https://www.martinfowler.com/eaaCatalog/activeRecord.html

July 22, 2025

Why Do I Have to Use the Factorybot Gem, Again?

The FactoryBot gem, previously known as FactoryGirl, is ubiquitous in Ruby and Ruby on Rails testing. If you aren’t familiar with it, you might be wondering, what’s the point? Wouldn’t it be simpler to just build objects myself? ...

October 17, 2022

Why Ruby?

Why should someone learn Ruby in 2022? Ruby was my first programming language, and although I’ve drifted elsewhere, I write Ruby every day. Many people in my network are Ruby diehards. As a result, it’s been a long time since I’ve gotten the chance to sell someone on Ruby. ...

June 30, 2022

Hash Fetch Instead of If/Else

Conditional logic has its place, but often there’s a better alternative. Today, we’ll look at a Ruby solution: a hash with .fetch. ...

April 16, 2022

RSpec.describe vs. describe: Which Should I Use?

Ruby’s RSpec describe block has two common syntaxes. Which should you use? ...

April 2, 2022

Ruby's Frozen String Comment: YAGNI

Open a production Ruby file, and you’ll often see this magic comment at the top. # frozen_string_literal: true Today I’d like to argue that most Ruby files do not need this comment. You aren’t going to need it. ...

February 9, 2022

Augmenting an Object With the Proxy Pattern

Let’s look at the proxy pattern in Ruby. ...

February 26, 2021

Binary to Decimal Conversion in Ruby

This week I wrote an algorithm in Ruby to convert binary numbers into decimal numbers. Here’s the problem description, from Exercism: “Convert a binary number, represented as a string (e.g. ‘101010’), to its decimal equivalent using first principles. Implement binary to decimal conversion. Given a binary input string, your program should produce a decimal output. The program should handle invalid inputs.” ...

May 4, 2017

Porting TIL from Rails to Phoenix: Initial Commits

Last week, I started a new project: porting Today I Learned from Ruby on Rails to Phoenix (Elixir). ...

November 29, 2016

Server Side Sorting in Ruby

Recently a friend asked me this question about server-side sorting in Rails. Here’s the question and my answer. ...

June 28, 2016