home articles newsletter

A Ruby on Rails blog

Hello, fellow Ruby on Rails programmer. Looking for my Ruby on Rails tutorials and posts? You've come to the right place.

This is where I gather all the blog's entries about Ruby on Rails. There are currently 9 posts about Rails in this series.

Delegated types in Rails: I tried them, and I'm not sure I really understood them.

Delegated types are a modelization pattern introduced in Rails in 2020. And developers have mostly been scratching their head for a few years trying to use them in their applications. Today, I want to share a real-world use case. I'll walk you through my pre-existing domain architecture, my initial requirements, my mistakes, how I eventually used delegated types, what I learned and my open questions.

Read this essay →

Pick a standard and move on

Why would you spend your cognitive capacity on useless choices?

Read this essay →

Refactoring in practice: moving toward convention

A few months ago, I had to write a Rails micro-service that synchronizes data between two versions of an application. I'll show you the successive steps I used to refactor this piece of code, from shameless-green to convention.

Read this essay →

Build a minimal feature flags manager in under an hour

Feature flags (or feature toggles) are a neat way to hide in-progress features from your users. For those who need a simple on-and-off system, here's a minimal feature flag manager that'll take less than an hour to build, using plain Ruby objects, the Rails configuration, and some neat variables organization.

Read this essay →

Upgrading Ruby on Rails: a beginner's guide

You're about to upgrade your application to the newest version of Ruby on Rails. And you've never done it before? Fear not! Here's my battle-tested companion to migrating Rails.

Read this essay →

Get started with ActiveRecord scoped associations

Active Record Associations are a great feature of Rails. But I never thought of using scopes with has_one or has_many associations until recently! So let me show you a neat little trick that'll make your code much much more expressive (and keep your N+1 queries in check).

Read this essay →

Asynchronous HTTP requests in Rails

Let's look at how we can update parts of our app's pages with asynchronous HTTP requests. This is a step-by-step how-to with some good ol' Javascript fetch() method, and Rails native server-side partial rendering.

Read this essay →

How to use railway-oriented business transactions to unclutter your Rails controllers

When your Rails app needs to handle multiple steps, your controllers' methods can become a mess. Let's see how to Marie-Kondo them with dry-transaction

Read this essay →

Add Omniauth GitHub to Your Rails App on Top of Devise

As I’ve moved into the last three weeks of Le Wagon coding bootcamp, the need to authorize people to sign-up with GitHub quickly arise. Here's a step-by-step tutorial on how to do it when you already use Devise to handle authentification.

Read this essay →

Wanna read more? Browse the complete archive.