The F-Word:

Ruby on Rails

Testing Active Record-based Modules

As Rails developers, Active Record plays a very large role in our applications. Active Record models often share a lot of behavior that can be extracted into modules, which are built on top of, and rely on, Active Record behavior. Here we will discuss... Read more »

The Quest for Simple Active Record Repositories

The goal of this post is to explore the various ways we might organize our Active Record model scoping behavior, before arriving at a simple pattern for defining and using repositories. When Dinosaurs Roamed the Earth One of the joys provided by... Read more »

The Trials and Tribulations of `try` in Ruby on Rails

We’re going to be covering Object#try, which is provided by Active Support’s core extensions. We’ll talk about what’s changed from Rails 3 through 5, and some intricacies to be aware of when using it. Rails 3.2 and introduction to trying For reference... Read more »

Skipping Shared Examples In RSpec

The other day as I was getting ready to deploy some code I had been working on, I noticed a pesky non-deterministic spec (a test that passes sometimes but fails other times) in our test suite. Since such specs compromise the integrity of the test suite... Read more »

ActiveRecord: When does includes do a join, and when does it do a second query?

Wait, what’s the question? The other day, we were working our Rails application for Interport, and we ran into an issue where an ActiveRecord query with an includes clause was performing a join, when we felt it would have been more efficient and improve... Read more »