Client Background

Our client, a growing startup, approached us for a Ruby on Rails upgrade. For over a decade, they had been using a legacy application built in Ruby 2.1.3, Rails 4.1.6, and MySQL 5.7, dating back to 2013. With over a decade of accumulated business logic and functionality spread across 20 controllers, 10 models, 5 service objects, and approximately 150,000 lines of code, the application had become difficult to maintain and was out of compliance with modern security and infrastructure standards.

As part of their SOC 2 Audit, a system upgrade was not just necessary—it was urgent.

Problem Statement

The client’s primary challenges were:

  • Aging technology stack (Ruby 2.1.3, Rails 4.1.6)
  • Unsupported frontend framework (AngularJS)
  • Outdated gem dependencies (https://rubygems.org/gems/next_rails/versions/1.0.0)
  • Incompatibility with modern DevOps, security, and testing tools
  • Moreover, maintenance and feature development were both costly and risky due to technical debt

Our Approach

We evaluated two potential upgrade paths:

  1. Step-by-step upgrade: A traditional and safer approach, especially suitable for tightly coupled gem dependencies.
  2. Direct leap to latest version with AI support: A modern approach leveraging AI-assisted development tools to reduce the time and complexity of a full upgrade.

We opted for the second route—a direct upgrade to the latest stable versions—combined with strong QA oversight. With recent advancements in AI-assisted code transformation, this approach proved highly efficient without compromising quality.

Tech Stack Upgrade Summary

 

Component From To
Ruby 2.1.3 3.1.4
Rails 4.1.6 7.1.3.2
MySQL 5.7 8.0.42
Frontend AngularJS Planned migration to ReactJS

Originally built with Ruby on Rails 4.1.6 and AngularJS, AstuteDoc had an ambitious vision:

  1. Modernize the tech stack for performance and maintainability.
  2. Integrate Generative AI to enhance clinical workflows.
  3. Achieve SOC 2 Certification for data security and regulatory trust.

Our team partnered with AstuteDoc to transform the platform into a next-generation, AI-driven, SOC-compliant healthcare solution.

Execution Road Map For Ruby on Rails Upgrade

1. Initial Setup

  • Created a fresh Rails 7 project using Ruby 3.1.4
  • Migrated the AngularJS frontend files into the new Rails structure (prior to full ReactJS rewrite)
  • Installed modern equivalents of deprecated gems (e.g., replacing protected_attributes, upgrading Devise, etc.)

2. Code Migration & AI Integration

  • Used AI tools to assist controller-by-controller and model-by-model upgrades
    • AI identified deprecated Rails patterns and recommended replacements
    • Manual intervention ensured context-aware corrections, especially in business logic
  • Replaced all instances of HashWithIndifferentAccess with standard JSON structures, including database migrations to transform legacy data
  • Upgraded ActiveRecord methods, replaced deprecated callbacks, and updated service objects

3. Devise Compatibility

  • Devise did not support the existing user data out of the box
  • We wrote custom scripts to make legacy authentication data compatible with the updated Devise gem

4. Environment Setup & Testing

  • Set up Development and UAT servers for continuous QA and stakeholder review
  • Final deployment on Production after successful sign-off

Ruby On Rails Upgrade – Key Challenges & Solutions

 

Challenge Solution
Devise not working with legacy DB Wrote custom data transformation scripts
HashWithIndifferentAccess deprecated Manual refactor + AI + external research
Monkey-patched legacy methods Identified and replaced with modern alternatives
AI-generated code had interdependencies Manual debugging and validation using full app context
Rspec tests missing/outdated Rewrote and upgraded Rspec test cases to latest standards
Understanding business logic from legacy code Deep code walkthroughs and stakeholder discussions
Ruby on Rails Upgrade – Challenges

Role of AI in the Upgrade

What AI Did Well:

  • Rapidly identified and suggested replacements for deprecated Rails code
  • Helped reframe controllers, models, and services for compatibility with Rails 7
  • Automated code checks to highlight potential failures before testing

Where AI Fell Short:

  • Inconsistent or incomplete support for interdependent front-end code
  • Could not handle complex hash refactoring or monkey patches effectively
  • Required human oversight to maintain accuracy and preserve domain logic

Estimated Effort

Role Approx. Hours
Mid-level Dev 407 hours
Senior Dev 180 hours
QA Team 160 hours
DevOps 22 hours

(Final estimates depend on active collaboration with client-side teams and post-deployment support.)

Outcome

  • A fully modernized, scalable, and secure backend ready for SOC 2 compliance
  • Seamless transition to Ruby 3.1.4, Rails 7.1.3.2, and MySQL 8.0.42
  • Future-proofed infrastructure, enabling easier frontend migration to ReactJS
  • Clean, test-covered, and production-ready codebase with minimal business disruption

Client Value Delivered

  • Faster time to upgrade via AI + manual hybrid approach
  • Cost-effective transformation without step-by-step overhead
  • Improved maintainability, security, and performance
  • Stakeholder confidence through UAT environment and transparent communication

Conclusion

This Ruby on Rails upgrade showcased the strength of blending AI-assisted engineering with senior developer insight. While AI handles routine tasks efficiently, it was real engineering effort that solved complex issues in authentication, serialization, and legacy business logic.

At SaaStrail, we specialize in modernizing legacy applications with deep expertise in Ruby on Rails, AngularJS, and scalable cloud architecture. Whether you’re aiming for SOC 2 compliance, improved performance, or complete tech transformation, we’ve got you covered.

👉 Explore our Rails Upgrade Services: saastrail.com