Sign up for my newsletter

Let's learn to become better developers.

Building Web Applications with Ruby on Rails

This is the first article in the series on building awesome web applications with Ruby on Rails. It explores why you should build for the web and use a web framework, especially Rails.

October 11, 2022

Building Web Applications with Ruby on Rails

Understanding Blocks and the Difference in Proc and Lambda

Blocks are one of the coolest features of Ruby. This blog post explains the concept of blocks and the difference between Proc and lambda.

October 07, 2022

Understanding Blocks and the Difference in Proc and Lambda

Compare Strings Using Inquiry

Similar to the ArrayInquirer class, which tests if an array contains a value, the ActiveSupport::StringInquirer class provides a nice way to compare two strings. Use it when you have an internal method that returns a string, and the consumer of that method needs to compare it with another string.

September 30, 2022

Compare Strings Using Inquiry

How to Compress a String in Ruby (and Rails)

You can compress large strings using the Zlib module provided by Ruby's standard library.

September 28, 2022

Configure Classes Using the Configurable Concern in Rails

Rails provides a `Configurable` concern that lets you add configuration options on classes.

September 27, 2022

Configure Classes Using the Configurable Concern in Rails

How to Access Variables Outside Scopes in Ruby

In C# and Java, variables from the outer scope are visible to the inner scope. In Ruby, scopes are sharply separated, and nested visibility is not allowed. As soon as the control enters a new scope, i.e. a class, module, or a method, the previous bindings are replaced by a new set of bindings.

September 23, 2022

Ruby is a Meritocracy

I recently read Russ Olsen's book Design Patterns in Ruby. In it, the author makes a wonderful distinction between statically vs. dynamically typed languages, which is different from all other comparisons I've seen.

September 22, 2022

How to Benchmark Rails Views

This post explores the Benchmarkable module provided by Active Support to measure the execution time for rendering Rails views.

September 21, 2022

How to Benchmark Rails Views

How to Benchmark Ruby Code

The Benchmark module in the Ruby standard library helps you measure and report the time used to execute your code. This post explores three useful methods in this module, which allow you to measure and compare the execution times of code as well as warm up the code to stabilize the runtime environment.

September 16, 2022

Understanding Authenticity Tokens in Rails

This post explores CSRF vulnerability and how Rails mitigates it using authenticity tokens. We will will learn why they're needed, how they're generated, how Rails uses them to verify the requests, and how to disable them for specific requests.

September 13, 2022