Zero disruption Rails 7 upgrade for a healthcare platform

A real-world case study on a phased Rails upgrade from 5.2 to 7.1 that improved performance, security, and compatibility for a medical platform.

Healthcare icons at each corner of hexagon

Business Requirement

Founded in 2012, our client, a US-based medical communication organization, specializes in assisting biopharmaceutical companies with impactful live and virtual events to bring their scientific discoveries to healthcare providers and patients successfully.

Their application used Ruby v2.7 with Rails v5.2 for backend processing, MySQL for data storage, and Rspec for unit and integration testing. By the time the ecosystem around Ruby on Rails evolved, they began to face several cracks in terms of stability, scalability, and security in their application.

At this point, our journey with them was already three plus years old, as we were supporting them closely for their application maintenance. As our team was the one to notice the technical challenges and limitations they faced in their development pipeline, we communicated them to the client, and they decided to upgrade the RoR version. (Our familiarity with the client's infrastructure became an extra edge for us to speed up the process of upgrade)

Objective

The main goal was clear: modernize the client’s application by upgrading from Ruby 2.7 to 3.0 and Rails 5.2 to Rails 7.1.

Approach

We initiated the upgrade process by framing the comprehensive step-by-step roadmap that included everything from codebase refactoring to RSpec changes. The client's only concern was planning the upgrade without disrupting their ongoing work. To ensure this, we created a completely isolated environment for the RoR upgrade process.

During the development phase, we carefully upgraded Rails and Ruby versions, refactored the codebase for compatibility, and addressed all possible performance improvements. We also ensured that we meticulously documented every step taken, bug encountered, the context in which they occurred, and solution provided, along with Rspec failures and fixes throughout the process.

Once developers made sure all specs passed successfully, the QA team conducted thorough testing of the entire application, updating their automation scripts as needed. When the upgrade was fully tested and stable, we planned for incremental deployment (Rails 5.2 → Rails 6.1→ Rails 7.0→ Rails 7.1) to minimize the risk of downtime. We also scheduled a maintenance window and closely monitored the deployment to ensure a smooth transition.

We believe transparent communication with clients is the key to successful completion of any project. Leading that way, we kept our client informed at each stage of the process. This approach brought them clear visibility into what we faced in real time, leading to a successful Rails upgrade.

The Challenges

Every business is different, and so is every upgrade. We strongly believe that the real success of any upgrade lies in spotting the client’s unique challenges and plotting out the best course of action for an upgrade.

Client-side challenges:

Performance bottlenecks: The outdated framework struggled to keep up with traffic when the user base grew. Delays in request handling pulled down the page loading speed, limiting the overall performance and business's scope to scale efficiently.

Security vulnerabilities: Older versions of Rails lack the security patches provided in newer releases. With security breaches being one of the growing concerns in the technological space, staying still with older versions left the application susceptible to known vulnerabilities.

Compatibility issues: Newer gems, libraries, and technologies increasingly became incompatible with the older Rails version. Result? Adding new features or other new integrations demanded time-consuming workarounds and made it harder to scale the app.

Developers-side challenges:

Maintenance overhead: To support an older version of Rails, our developers’ team had to spend significant time on manual bug fixes, workarounds, and custom patches.

Obsolete dependencies: As the Ruby ecosystem evolved, dependencies such as gems and middleware became outdated, which in turn led to potential integration issues and bugs.

Handling a Large-Scale Application: As the client's application was a large-scale application with 7-8 microservices, developers faced numerous difficulties during the time of the upgrade to coordinate changes across multiple codebases and manage dependencies to avoid conflicts between different microservices.

Solution

For us, the rule of thumb was to ensure the client’s application were up-to-date and vulnerability-free. Keeping this in mind, we upgraded the Ruby and Rails versions of the application and unfolded the following solutions:

Created isolated environment

We began by creating a new, dedicated environment for the ROR upgrade, ensuring that any changes in the upgrade process would not affect the client’s ongoing work and the original codebase. Although twofold effort was required throughout to maintain both the older version and newer versions simultaneously in sync, we could keep our word by making the upgrade possible without causing any disruptions to the client in any way.

Adopted streamlined approach

To handle the client’s large-scale application, we broke down the upgrade into smaller, manageable tasks. It helped us to focus on key areas, reducing the risk of overlooking potential issues. Besides, regular team meetings facilitated efficient coordination and prompt issue resolution.

Gem updates

We carefully evaluated the key gems and dependencies, noting down the error messages and the circumstances in which they occur. We then fixed the errors and updated the gems to their latest compatible versions, ensuring they perfectly fit together with the Rails 7.1 version.

Code refactors

We also analysed legacy code to find all outdated gem dependencies and Rails APIs. We then refactored them in a few sections to align with modern Rails practices and minimise technical debts.

Testing and QA

Our team meticulously updated the test cases written for an older version to match the new version’s syntax. From unit testing and regression testing to performance testing and security testing, we executed all of them rigorously to ensure that the upgrade did not introduce regressions or issues in the production environment.

Benefits

Enhanced Security:

There is a reason why businesses opt for Ruby on Rails upgrade when they can skip them, especially when the budget is limited. The real kicker? The security threat. As technology evolves, so do the ways of data breaches.

From enhanced vulnerability detection mechanisms and cryptographic primitives to stricter parameter filtering and improved XSS protection capabilities, both Ruby 3.0 and Rails 7.1 versions allowed the client's application to leverage the latest security patches, steering clear of vulnerabilities and ensuring compliance with modern security standards.

Improved Performance:

Users want every action to happen faster. With myriads of options available in today’s world, no one would wait for a website or app to load at its own pace. With the introduction of new features and enhancements in Ruby 3.0 and Rails 7.1, this upgrade paved the way to reduce page load times, optimise resource usage, and provide faster responses, improving user satisfaction and experience.

Scalability:

Rails 7.1 offers improved multi-threading support, enhanced concurrency, and Hotwire/Turbo capabilities that reduce server load while improving real-time interactions. This enabled the platform to scale more efficiently as the event traffic increased.

Better Development Experience

Key Rails 7 enhancements dramatically improved developer productivity:

  • Zeitwerk-only autoloading

  • Hotwire & Turbo integration

  • Importmap or ESBuild/Propshaft flexibility

  • Improved ActiveJob and ActionMailer APIs

  • Clearer, structured deprecation paths

These enhancements reduced maintenance overhead and accelerated new feature development.

Compatibility:

The upgrade ensured compatibility with new versions of third-party libraries and gems, reducing the need for custom patches. Besides, the Rails 7.1 framework provided clear deprecation warnings to identify and address outdated code practices, which helped prevent compatibility issues in the future.

Conclusion

As promised, we successfully completed the ROR upgrade without halting the client’s day-to-day operations in any way. By success, we mean understanding the client’s unique situations, clearly planning the upgrade, and transforming their application to stable, reliable, and future-ready ones. While ROR upgrade is generally considered a daunting process, we were able to complete the project within 2 months of time, despite the complexity of the application.

Being an organization that conducts live and virtual events, the ROR upgrade helped our client to easily handle peak traffic during popular events, increasing engagement and customer satisfaction. Besides, the compatibility improvements from the Ruby on Rails upgrade ensured that their application remains up-to-date and integrates with new technologies to stay competent in the rapidly evolving medical communication industry.

Your one-stop shop for expert RoR services.

Join 250+ companies achieving top-notch RoR development without increasing your workforce.