Polished Ruby Programming
August 3, 2021 in ruby

I started reading Polished Ruby Programming by Jeremy Evans, author of the popular sequel and roda libraries. This is an advanced Ruby book, diving into the design principles, best practices, and trade-offs while programming Ruby. So far, it hasn’t disappointed. Here are my notes from the first chapter.

Read More
Overriding Constructors in Ruby
July 29, 2021 in ruby

Everything in Ruby is an object, including the class. When you create a new class, you are basically creating an instance of class Class. Ruby even allows you to override the new method on a class, allowing you to customize the creation of all objects.

Read More
Ruby Sweetness
July 28, 2021 in ruby

In my journey to learn and master Ruby, I keep coming across new syntactic sugar every day that makes me happy. This morning, I stumbled upon the double-splat ** operator while learning about the FileUtils standard library.

Read More
Active Record Queries
July 25, 2021 in rails

There are two types of finder methods in Active Record; those that return a single instance of the model, e.g. find and first, and those that return return an instance of ActiveRecord::Relation representing a collection of instances, e.g. where and group. This post summarizes the query methods that return a single instance.

Read More
Running Rails Migrations
July 22, 2021 in rails

In one of my previous posts, we saw how to create migrations in Rails to update the database schema. However, creating a migration on its own doesn’t update the database. You have to run the migration to make the changes. This post summarizes all the commands that modify the database.

Read More