Refactoring a 7-Year-Old Ruby on Rails Platform: Cleaner Code and Up to 40% Faster Development

A large US sports association (name is under NDA) that supports more than 30,000 teachers, coaches, and managers found that adding new features to its 7-year-old Ruby on Rails platform was taking more and more time and budget.

MobiDev engineers joined the client’s in-house team to upgrade Rails, rebuild the test suite, and refactor the code. The result: up to 40% faster development and 89.8% backend test coverage.

Client Country

USA

Country

Client Industry

Sports

Industry

Client Cooperation

2019-Now

Cooperation Period

Client Cooperation type

Legacy Modernization, Team Augmentation

Cooperation Type

The Story Behind the Ruby on Rails Modernization

By 2019, the US sports association ran several web and mobile applications for members and fans, including tools for event management, live scoring, and scheduling. Some of those apps had been in production for 7 years.

The platform ran on an older version of Ruby and Ruby on Rails. It relied on numerous Ruby gems, many of which were outdated or incompatible with newer Rails releases. As the platform grew, so did technical debt and performance bottlenecks.

The in-house team didn’t have the capacity to build the new features and modernize the application at the same time. Instead of growing the team, the association brought in MobiDev engineers to modernize the legacy code.

Business Value of Modernizing the Legacy Ruby on Rails Platform

Up to 40% faster development. Refactoring ran alongside feature work and reduced the time spent on each change. It made the 7-year-old code easier to maintain and let the team adopt modern practices and technologies gradually.

89.8% backend test coverage. After the test suite overhaul, 89.8% of the backend code is covered by tests, inside the 80 to 90% range that Google’s engineering team considers a strong level of confidence.

Project Scope: Ruby on Rails Modernization Without a Feature Freeze

Stage 1. Step-by-step Rails upgrade. The platform moved through multiple major Ruby on Rails releases. Versions differed significantly, so each step meant careful planning, extensive code updates, and thorough testing before the next one.

Stage 2. Dependency review. We reviewed the Ruby gems the system relied on and replaced the outdated and incompatible ones to keep the platform stable on newer Rails versions.

Stage 3. Test suite overhaul. We replaced MiniTest with RSpec and rebuilt the test suite from the ground up. The goal was to catch bugs before release: NIST estimates that a bug found in production costs up to 30 times more to fix than one caught during development.

Stage 4. Refactoring alongside new features. MobiDev engineers handled the refactoring while the in-house team kept shipping features, so the product roadmap did not stop for modernization.

Stage 5. New features with the in-house team. Once the main refactoring was complete, MobiDev engineers switched to building new features and expanding functionality together with the client’s developers.

Why We Chose Refactoring Over a Rebuild

A complete rebuild often looks like the cleanest way out of legacy code, but it costs the most and takes the longest. For this client, it would also have meant running the old and the new systems side by side, while members relied on the old apps for events, live scoring, and scheduling.

The platform’s architecture still supported the association’s business. What slowed the team down was the code itself: an old Rails version, outdated gems, and accumulated technical debt.

Refactoring improves the structure of existing code without changing its core functionality. It let us reduce technical debt and performance bottlenecks while the platform stayed live. It also lowered the cost of supporting legacy code. As a result, development became up to 40% faster.

Tech Stack

Backend
Testing
Web Frontend
Mobile
Ruby
Ruby on Rails
RSpec
JS
Flutter
Backend
Ruby
Ruby on Rails
Testing
RSpec
Web Frontend
JS
Mobile
Flutter

Ship New Features on Your Legacy Platform Faster

Fill out the form and share your product needs. Our experts will get back to you within 1 business day.

FAQ