Articles by Rishi Jain

Follow @rishijain on Github

Bootstrap 4 to 5, One Controller at a Time

You’ve decided your Ruby on Rails app needs to move from Bootstrap 4 to Bootstrap 5. Bootstrap 4 is end of life opens a new window and no longer receives bug fixes or security updates. Maybe you also want to get jQuery out of your front end, or maybe a component you need only exists in version 5. The catch is that Bootstrap 5 renames classes and data attributes, and that touches many of the views in the app. In a large application, changing all of them in a single pull request is hard to review, hard to test, and hard to roll back.

We recently borrowed the idea behind the Dual-Boot technique opens a new window , running two versions of a dependency side by side, for something other than Rails: Bootstrap itself. Instead of upgrading everything at once, we kept both versions in the app and moved one controller at a time, for many of the same reasons that you might upgrade Rails in increments opens a new window . In this article, you will learn how to run Bootstrap 4 and 5 side by side in one Rails app, how to pick the version per controller with a layout, and how to sequence the migration into small pull requests.

Read more of Bootstrap 4 to 5, One Controller at a Time opens a new window

Migrating From Sprockets to esbuild in Rails

At FastRuby.io, we spend a lot of time upgrading Ruby and Rails applications. However, we do more than just that, we also pay attention to other areas of the application that can be improved. For example, we recently migrated a customer’s application from Sprockets to JS bundling with esbuild opens a new window .

In this article, I share my experience migrating from Sprockets opens a new window to JS Bundling opens a new window (JavaScript Bundling for Rails).

This is not a step-by-step guide, as each application has its own unique needs. Instead, I discuss the problems I encountered and the approach I took during the migration to JavaScript bundling.

Read more of Migrating From Sprockets to esbuild in Rails opens a new window

Common Culprits in Rails Performance Issues

When it comes to improving application performance and areas to focus on, I would recommend looking at the APM data, and then deciding which areas to prioritize.

However this article isn’t about where to focus efforts, but rather a compilation of techniques to improve your application’s performance, from tackling common problems like N+1 queries and database indexing to leveraging the jemalloc memory allocator. Let’s look at these performance-boosting strategies designed to fine-tune your application.

Read more of Common Culprits in Rails Performance Issues opens a new window

7 Common Mistakes in Rails Upgrades

Ruby on Rails opens a new window is a popular web application framework that is constantly evolving with new versions being released frequently. While upgrading to a newer Rails version can bring new features, better performance, and security patches/improvements, it can also be a challenging task.

In this blog post, we will discuss 7 common mistakes made while doing Rails upgrades opens a new window and how to avoid them.

Read more of 7 Common Mistakes in Rails Upgrades opens a new window
Get the book