Sign up for my newsletter

Let's learn to become better developers.

If You're a WordPress Developer, Learn Ruby and Rails

With the recent WordPress drama, many developers might be concerned about its future. While WordPress isn't likely to go away, now might be the perfect time to invest in learning other tools and technologies. I suggest Ruby on Rails - you won't regret it!

September 26, 2024

If You're a WordPress Developer, Learn Ruby and Rails

How to Count the Number of Commits After a Specific Commit in Git

Counting the number of commits after a specific commit in Git is a common task when you make small but frequent commits and need to squash them before rebasing from the main branch. This post shows one simple way to do this in git. Let me know if you know a better solution.

August 25, 2024

How to Count the Number of Commits After a Specific Commit in Git

The Rails Router Handbook

For the past few days, I've been trying to learn everything I could about the Rails router. I compiled all of my notes together with the past articles on this blog, and published a handbook on the router. I hope you find it useful and you learn a thing or two about the incredible Rails Router.

August 08, 2024

The Rails Router Handbook

Routing Concerns in Rails

You must have used concerns in Rails. Did you know you can also use concerns for your routes? They allow you to declare common routes to be reused in other resources and routes. This post covers the basics of routing concerns, including what they are, how they work, and when you might need them.

August 07, 2024

Routing Concerns in Rails

Understanding Shallow Nested Routes in Rails

One way to avoid deeply nested routes in Rails is to use shallow nesting. This means you keep the routes that list or create records scoped under the parent resource, so the relationship is clear. But for routes that act on a specific record, you don’t include the parent in the URL. Instead, you use only what’s necessary to uniquely identify that record, which keeps routes shorter and easier to work with.

August 06, 2024

Understanding Shallow Nested Routes in Rails

Working with Resourceful Routes in Ruby on Rails

The concept of resourceful routing took me a long time to understand, but once it clicked, it changed how I viewed web applications. This post covers the basics: what a resource is, the routes it generates and how resourceful routing provides a nice organizational structure your Rails applications.

August 02, 2024

Working with Resourceful Routes in Ruby on Rails

Map a Resourceful Route in Rails to Another Controller Class

You can map a resource to a different controller by passing the controller option to the resources method.

July 29, 2024

Map a Resourceful Route in Rails to Another Controller Class

How to Route an Incoming URL to a Rack Application in Rails

The Rails router can dispatch an HTTP request to a Rack endpoint, either in your application or within a gem. This is useful when you want to provide a well-isolated web UI or front-end to the users of your gem. In this post, we'll learn why you may want to do this, how it works, and how to do it.

July 29, 2024

How to Route an Incoming URL to a Rack Application in Rails

Working with Nested Resources in Ruby on Rails

Nested resources in Rails model parent–child relationships in routes, like comments under posts. They make intent clear and improve semantics, but should be used sparingly. Shallow nesting keeps URLs readable and controllers simpler.

July 22, 2024

Working with Nested Resources in Ruby on Rails

How to List and Filter Routes in Ruby on Rails

This post shows how you can list all the routes in your Rails application and find or filter them using the grep option. You can list all the routes in your Rails application by running the `bin/rails routes` command in the terminal. or by visiting `/rails/info/routes` path on a running Rails application.

July 18, 2024

How to List and Filter Routes in Ruby on Rails