Ruby 2.7 support for Rails 3.2 LTS
Rails 3.2 LTS works with Ruby 1.8.7, 1.9.3, 2.3, 2.5, and 2.7. "Support" means that upgrading a Rails 3.2 application to Ruby 2.5 will not require Rails related monkey patches.
However, upgrading will still require some effort for the majority of Rails 3.2 applications, since your own code as well as some third-party gems might have compatibility issues. This is especially
true if you upgrade from Ruby 1.x. You should only attempt this as a somewhat experienced Ruby developer, and only if you have a good automatic test suite, or if you're confident that you can manually test your application.
- Upgrade to the latest version of Rails 3.2 LTS.
- Upgrade your Ruby version. If you were still on Rails 1.x, you could consider switching to Ruby 2.3 as an intermediate step.
rails consoleand fix all errors. See below on how to fix common errors.
rails serverand fix all errors until a page renders.
- Run tests and fix remaining errors.
Your application will probably depend on a bunch of other gems, and some of those might be incompatible with newer Rubies. The most common case are gems with native extensions that no longer compile.
You will have to check, whether these gems have an updated compatible version, can be removed, might be fixed with a monkey-patch, or have to be replaced.
An incomplete list of known incompatibilities:
date-performance-> remove this, no longer necessary
fastercsv-> no longer required, Ruby now has builtin
mysql-> no longer compiles on Ruby 2.5, see below
therubyracer-> version 0.12.3 (with
libv8 184.108.40.206) seems to work
mysql gem does no longer work on Ruby 2.5. Instead, use
mysql2, in a 0.3.x version (
< 0.4 in your Gemfile should do).
mysql2 is mostly a drop in replacement for
mysql. The main API difference is that you might get casted values (i.e.
Time objects instead of strings) when you use some low-level methods of ActiveRecord, such as
If you attempt an upgrade from a Ruby 1.x version, you might find some additional pointers in the corresponding section of the Rails 2.3 upgrade guide.
The main issue when upgrading to Ruby 2.5 is that there
Bignum are deprecated and replaced by a unified
Integer class. This mostly only causes deprecation warnings, but not errors, since
Fixnum resolves to
If a third-party gem uses
Fixnum and you want to remove the deprecation errors, you can often manually define a
Fixnum class in the gems namespace. For example, we've added the following initializer to one of our projects:
# config/initializer/fixnum_deprecation_fixes.rb # will_paginate WillPaginate::Fixnum = Integer BootstrapPagination::Fixnum = Integer # axlsx Axlsx::Fixnum = Integer