· · Matthew Ford · 4 min read
Common Challenges in Supporting Legacy Ruby on Rails Applications
What Makes a Rails Application "Legacy"?
A Rails app becomes "legacy" when it runs on outdated technology. The warning signs include:
- Old versions of Ruby and Rails
- Outdated gems and dependencies
- Monolithic code structure
- Weak or missing test coverage
- Poor documentation
- Accumulated technical debt
Why Companies Keep Legacy Rails Apps Running
Businesses stick with legacy Rails applications for solid reasons:
Starting over costs too much. Basecamp once calculated that rewriting their original Rails app would take 30 developer-years and millions of dollars.
Business operations can't stop. These apps often run core processes. Shopify, built on Rails, handles over $543 billion in yearly sales. You can't pause that.
They work reliably. Well-maintained legacy Rails apps prove rock-solid. GitHub, also on Rails, maintains 99.98% uptime since 2018.
They contain years of business logic. Old apps have accumulated business knowledge baked into their code. Airbnb's Rails platform manages 6 million listings worldwide. Recreating that complex logic? Not simple.
Everything connects to them. Legacy apps often integrate with numerous other systems. Zendesk serves 170,000 customers and connects to countless tools. Replacing those connections creates massive complexity.
The Real Challenges of Legacy Rails Apps
Outdated Dependencies
Old gems and libraries create serious problems. They cause security vulnerabilities, compatibility headaches, and eliminate access to bug fixes.
In 2021, the activerecord-import gem had a security flaw in versions below 1.0.7. Many old Rails apps became vulnerable until teams updated.
Poor Performance
Legacy Rails apps often run slowly because of:
- Inefficient database queries (N+1 queries)
- Bloated JavaScript and CSS files
- Slow actions within the request cycle
Performance expert Nate Berkopec notes: "Performance is rarely the first priority of any organization, and often gets 'trickled down' hours and resources."
Scaling Problems
As user numbers grow, legacy apps start to struggle. Common issues:
- Database bottlenecks
- Memory leaks
- Inadequate caching strategies
Maintenance Difficulties
Working with old code creates daily frustrations for developers:
- Tangled, spaghetti code
- Missing or outdated documentation
- Outdated coding practices
- Minimal test coverage
Integration Barriers
Connecting modern technology to legacy systems feels like fitting a square peg in a round hole:
- Outdated APIs
- Incompatible protocols
- Legacy code that can't handle new data formats
Developer Shortage
Finding developers who know older Rails versions grows harder each year. This leads to:
- Slower development cycles
- Higher costs
- Teams lacking experience with legacy systems
How to Support Legacy Rails Applications
Supporting old Rails apps requires consistent effort and smart strategies.
Schedule Regular Updates
Don't let your app gather dust. Create a maintenance schedule:
- Update Rails and Ruby yearly
- Check for security patches monthly
Shopify's team updates their main Rails app every 6-8 weeks. The result? 32% less downtime over a year.
Modernize Gradually
Trying to fix everything at once leads to chaos. Take it step by step:
Start with the database. Clean up your schema, add indexes, and optimize queries. One company improved app speed by 40% just by adding proper indexes.
Update the front-end next. Refresh your JavaScript or switch to modern Rails tools like Turbo and Stimulus. Basecamp's HEY app loaded twice as fast after moving to Turbo.
Refactor models and controllers. Break down fat models, introduce service objects, and slim down controllers. Your future self will appreciate the cleaner code.
Build Strong Test Coverage
Tests act as your safety net. Here's how to build one:
- Aim for 80% code coverage minimum
- Use RSpec or minitest for testing
- Set up continuous integration to catch issues early
GitHub runs over 250,000 tests on every push to their main Rails app. They caught 98% of bugs before production in 2022.
Document Everything
Keep knowledge in-house when team members leave:
- Use tools like Notion or Confluence for documentation
- Hold regular knowledge-sharing sessions
- Comment your code (especially the unusual parts)
Stripe's team dedicates 20% of their time to documentation and knowledge sharing. New developers now get up to speed in 6 weeks instead of 3 months.
Should You Rewrite or Update?
You're staring at your legacy Rails app. The big question: rewrite from scratch or update what exists?
This choice shapes your project's future.
Updating costs less upfront, preserves your business logic, and carries less risk (with proper testing).
Rewriting gives you a clean slate. You can build modern architecture, add new features easily, and fix deep-rooted issues.
But here's the reality: rewrites are riskier than updates.
The latest CHAOS data reveals a sobering truth about large IT project success rates. Only 31% of projects succeed overall. Half face serious challenges, and 19% fail completely.
The size of your project matters enormously. Small projects achieve roughly 90% success rates. Large projects? Less than 10% succeed.
Rewrites almost always become large projects. Updates and refactors typically stay small, focused, and manageable.
Factors to Consider
Think about these questions:
- How big and complex is your application?
- Do you have time and budget for a complete rewrite?
- Can your business handle potential downtime during a rewrite?
- How severe is your technical debt?
- Does your team have skills for a rewrite?
Your answers will guide you toward the right choice.
Moving Forward with Legacy Rails
Legacy Rails apps present real challenges, but they're not hopeless. The solution? Face the challenges directly.
Outdated dependencies, slow performance, and scaling issues affect most legacy systems. Regular maintenance and gradual updates make a real difference.
Take our work with RIS, a retail equipment supplier, as an example. Their existing Ruby on Rails system ran on old versions of Ruby across multiple servers. The outdated infrastructure created security risks and stability issues.
We tackled the update piece by piece. Our team implemented security and version updates across all servers, improved data backup and resilience systems, and fixed bugs while making general system improvements.
The results? Better system stability, strengthened security, and reliable backup systems now protect their business operations.
Andy Cook, CTO at RIS, shared: "These guys really went beyond requirements when we most needed them. The senior guy supported some complex and critical issues over the weekend which was very impressive."
This shows that even systems running significantly outdated Rails versions can be brought up to modern standards without a complete rewrite.
Your Action Plan
Keep your legacy Rails app running smoothly with these steps:
- Conduct regular code reviews
- Increase test coverage
- Use automated code linting tools
- Set up a staging environment that mirrors production
The update versus rewrite decision depends on your specific situation. Evaluate your app's complexity, technical debt level, and long-term business goals before choosing a path.
Do you need help with your application?
At Bit Zesty, we specialise in building and maintaining bespoke software and integrating AI into existing applications.
Looking to build an application, but unsure of the price? Keen to discuss our experience, processes and availability?