Sign up for my newsletter
Let's learn to become better developers.
Can You Spot the Error?
I recently encountered this error and in the process of debugging, learned some useful stuff about `self` and how assignment works in Ruby. See if you can figure it out yourself. Can you spot the error in this simple Ruby snippet?
April 23, 2023
A List of Books to Learn Programming with Ruby and Rails
This post provides a curated list of books to learn to code in Ruby and build web applications with Rails. It also gives a step-by-step path you can follow to learn enough before moving to the next step. If you ever wanted to learn to program but didn't know where to start, this post is for you.
April 20, 2023
How to Access Hash Values with Methods Using OrderedOptions
Have you ever wanted to create a hash where you could access the values like methods on an object? The OrderedOptions class in Rails lets you do just that. This post shows you how. We'll also explore how Rails implements this feature using Ruby's metaprogramming features.
April 15, 2023
The Definitive Guide to Rack for Rails Developers
The word Rack actually refers to two things: a protocol and a gem. This article explains pretty much everything you need to know about Rack as a Rails developer. We will start by understanding the problem Rack solves and move to more advanced concepts like middleware and the Rack DSL.
April 09, 2023
Readonly Attributes in Rails
In this article, we'll learn how to mark certain attributes as readonly on your active record models, to prevent them from any future updates after the record is created and saved to the database. We'll also learn how Rails implements this feature behind the scenes.
April 04, 2023
Sessions in Rails: Everything You Need to Know
In this post, we’ll learn about Rails sessions, including what is a session, why we need them, and why they're so important. I’ll also take you behind the scenes and show you how Rails implements sessions and where the `session` method actually comes from. Hint: it’s not in the Rails codebase.
March 29, 2023
Understanding the Attribute Assignment API in Rails
In this post, we will explore the `AttributeAssignment` module in Rails, which allows you to set an object's attributes by passing in a hash, a feature commonly used by Active Record models. We'll also learn a little metaprogramming along the way.
March 23, 2023
Progressive Application Development with Hotwire
This is the day when you fall in love with Hotwire. We're going to build a simple counter. But we're not going to build it once and be done with it. Instead, we'll build and progressively enhance it with all three frameworks in Hotwire: Turbo Drive, Turbo Frames, and Turbo Streams.
March 20, 2023
Configuring Rails Environments
Despite its strong opinions and powerful conventions, Rails is a highly flexible and configurable framework. If you don’t like something, there’s almost certainly a way to change it. This article provides a brief overview of configuring Rails applications and environments.
March 04, 2023
Turbo Streams: How They Work and Differ From Turbo Frames
No, you don’t need WebSockets to use Turbo Streams. You can simply use them to deliver multiple page updates with a single HTML response. This article teaches the basics of Turbo Streams to build a SPA without writing a single line of JavaScript. No Rails needed, either!
February 28, 2023