Thousands of Rails applications still run on versions 4, 5 or 6. Technical debt piles up: obsolete dependencies, unpatched vulnerabilities, degraded performance. Rails 8, released in late 2024, brings major improvements: built-in Solid Queue, Kamal 2 for deployment, removal of the Redis dependency, and significant performance gains. Migrating to Rails 8 is not a luxury, it has become a competitive necessity. But a poorly run migration can paralyze a production application for days. This practical guide presents a proven methodology, validated on real projects, for moving from your legacy version to Rails 8 safely, incrementally and with no service outage. Whether you start from Rails 4, 5 or 6, you will find here the key steps, the essential tools and the pitfalls to avoid at all costs.

Audit your legacy application before migrating to Rails 8

Before touching a single line of code, a complete technical audit is a must. This phase determines the success of the whole migration. It is the first step of any Ruby on Rails application takeover: you can only migrate well what you know well.

Map the dependencies and the current version

The first concrete action: run bundle outdated and rails -v. You get a precise picture of where you stand. List each gem and its compatibility with Rails 8. Some popular gems such as Devise, Pundit or Sidekiq require specific versions. Others have been abandoned. Better to know it right now.

  • Deprecated gems: identify them and find their replacements during the audit.
  • Ruby version: Rails 8 requires Ruby 3.2 at minimum. Check your current version.
  • Existing tests: a coverage rate below 60% is a major warning sign.
  • JavaScript dependencies: Sprockets vs Propshaft, Webpacker vs importmaps. Clarify what is in place.

Assess test coverage

A migration without a safety net is a dangerous migration. The test coverage rate is your number one indicator. Below 70%, invest time in writing integration tests on the critical paths: authentication, payment, data generation. SimpleCov gives you this figure in a few seconds.

“A Rails migration without tests is like crossing a highway blindfolded. Bugs are not a matter of if, they are a matter of when.”

Analyze the architectural friction points

Some parts of your code will be particularly sensitive to the migration. Complex ActiveRecord callbacks, monkey patches, overloaded initializers: document them systematically. Use tools such as RuboCop-Rails with the Rails 8 profile to detect incompatibilities automatically. Allow between 2 and 5 days of audit for a medium-sized application.

Build a prioritized migration backlog

At the end of the audit, put together a structured backlog. Rank each task by criticality and by estimated effort. This backlog becomes your technical roadmap. It will be the basis for discussion with your stakeholders to plan the migration with no budget surprises. To estimate the overall cost, read our guide to Ruby on Rails development pricing.

Define an incremental migration strategy to Rails 8

There is no single way to migrate. The incremental migration strategy is the one that minimizes risks in production.

Step-by-step migration: the recommended method

Jumping straight from Rails 4 to Rails 8 is technically possible but extremely risky. The recommended method is to migrate version by version: Rails 4 → 5 → 6 → 7 → 8. Each step is validated by the automated tests before moving on to the next. This approach takes more time overall, but it reduces the surface for errors at each step and preserves production stability.

Starting pointNumber of stepsEstimated durationComplexity
Rails 4.x4 steps6 to 10 weeksHigh
Rails 5.x3 steps4 to 7 weeksMedium
Rails 6.x2 steps2 to 4 weeksModerate
Rails 7.x1 step1 to 2 weeksLow

Keep the production branch stable

The golden rule: never block production during the migration. Work on a dedicated branch. Regularly merge security fixes from the main branch. A feature flag system lets you enable new features gradually without a risky deployment.

Choose the right staging environment

A staging environment identical to production is non-negotiable. Use real anonymized data for your tests. Surprises tied to production data are the leading cause of failure at go-live. With Kamal 2, included natively in Rails 8, managing environments becomes much simpler and more reproducible.

Involve the business team from the start

A technical migration affects delivery times for new features. Communicate clearly with stakeholders. Define a freeze window for new features during the critical phases. This transparency avoids tension and counterproductive pressure in the middle of the migration. To structure this support, discover our approach to Rails for business applications. Our Ruby on Rails agency has supported dozens of successful migrations to Rails 8.

The key technical steps of the migration to Rails 8

The method is set. Now for the concrete technical operations, in their logical order of execution.

Update Ruby and the main gems

Rails 8 requires Ruby 3.2 at minimum, with Ruby 3.3 recommended for optimal performance. Start by updating Ruby via rbenv or asdf. Then update the Gemfile: replace the Rails version constraint, then run bundle update rails. Do not update everything at once. Go gem by gem, running the test suite after each critical update.

“The 10-minute rule: if a gem update breaks more than 10 tests, do not go on. Investigate first.”

Handle the breaking changes of each major version

Each version of Rails introduces documented breaking changes. Rails 5 made ApplicationRecord mandatory. Rails 6 introduced Zeitwerk autoloading. Rails 7 removed Webpacker. Rails 8 removes the dependency on Redis for jobs and sessions. Systematically consult the official upgrade guides on guides.rubyonrails.org. The railsdiff.org tool visually compares configuration files between versions.

Adopt the native new features of Rails 8

Rails 8 is not just a security update. It is an overhaul of the infrastructure. Solid Queue replaces Sidekiq for most use cases. Solid Cache replaces Redis for caching. Solid Cable handles Action Cable without Redis. These three gems are now the default stack. Assess whether your infrastructure can adopt them. For very high-traffic applications, Sidekiq remains relevant, but for 90% of projects, Solid Queue is more than enough.

Validate with end-to-end integration tests

Before any production deployment, a battery of end-to-end tests with Capybara and Selenium simulates the critical user journeys. Automate these tests in your CI/CD pipeline. GitHub Actions with Ruby setup-ruby takes less than 30 minutes to configure. A 100% green pipeline is the essential condition for go-live. To track performance after the migration, also think about your technical maintenance plan.

Common mistakes, real costs and post-migration optimization

Knowing the classic mistakes lets you avoid them. Here are the most valuable lessons learned from Rails migrations in production.

The 5 mistakes that make a migration fail

  • Migrating without enough tests: test debt is paid in full when you go to production.
  • Updating all the gems at once: one broken gem among 50 simultaneous updates is impossible to find.
  • Ignoring deprecation warnings: Rails always warns before removing an API. These warnings are gifts.
  • Neglecting database migrations: columns with obsolete types can block ActiveRecord 8.
  • Underestimating the migration time: a medium-sized Rails 5 application actually takes 3 to 6 weeks of effective work.

Estimate a realistic budget for a migration

The cost of a Rails migration depends on three main factors: the starting version, the quality of the existing code, and the test coverage. As a guide, allow between €5,000 and €25,000 for a complete migration depending on complexity. A well-tested application starting from Rails 6 will cost much less than a legacy Rails 4 application with no tests. Not migrating, for its part, costs on average 20 to 30% of developer time in corrective maintenance every year.

Optimize performance after the migration

Once on Rails 8, do not leave empty-handed. Propshaft replaces Sprockets and cuts asset compilation times by 40 to 60%. Enable the SQLite query cache if you have chosen that database. Use Rack Mini Profiler to identify the N+1 queries introduced during the migration. These post-migration optimizations can improve response time by 20 to 50% compared with the old version.

Document and train the team on the new conventions

Rails 8 introduces new conventions. Your team must master them quickly. Organize code review sessions focused on the new features. Create an internal documentation page summarizing the architecture choices made during the migration. This documentation reduces onboarding time for new developers and avoids a return to old practices. A well-documented project is worth twice as much on the market. To go further with your development strategy, contact the Akolads team for custom support.

FAQ

How long does a migration from Rails 5 to Rails 8 take?

For a medium-sized application (around 50,000 lines of code), allow 4 to 7 weeks of effective work starting from Rails 5. This timeframe includes the initial audit, the step-by-step migration, the tests and validation in staging.

It can be shorter if the application has test coverage above 80% and a well-structured architecture. It can also be longer if there are many proprietary gems or tightly coupled code.

Can you migrate directly from Rails 4 to Rails 8 without going through the intermediate versions?

Technically yes, practically no. Skipping several major versions generates a number of breaking changes that is almost impossible to handle at the same time. The risk of regressions in production is very high.

The recommended method remains the step-by-step migration: each version is stabilized and tested before moving on to the next. This approach takes more time but guarantees continuity of service.

Does Rails 8 necessarily require Redis?

No, that is precisely one of the big new features of Rails 8. Solid Queue, Solid Cache and Solid Cable replace Sidekiq, the Redis cache and Redis for Action Cable respectively. These three components use SQLite or PostgreSQL as a backend.

Rails 8 can therefore run without Redis for the vast majority of applications. This simplifies the infrastructure and reduces hosting costs.

What test coverage rate do you need before starting the migration?

Aim for a minimum of 70% coverage before starting. Below this threshold, first invest in writing integration tests on the critical paths: login, data, payment.

Unit tests are useful, but end-to-end integration tests (via Capybara) are the most valuable during a migration. They validate the overall behavior of the application regardless of implementation details.

Should you call on a specialized agency to migrate to Rails 8?

For a production application with active users, the support of a specialized agency significantly reduces the risks. It brings a proven methodology, specialized tools and experience across many projects.

A failed migration can cost far more than a well-supported one. Contact Akolads to assess your project and get a precise estimate.