Upgrade from Ruby 1.8.7 to Ruby 2.3.0, Ruby 2.2 (2.2.4) and Ruby 2.1 — My Notes

Upgrade from Ruby 1.8.7 to Ruby 2.3.0, Ruby 2.2 (2.2.4) and Ruby 2.1 — My Notes

Issues I have found when doing Ruby on Rails upgrades of Ruby version 1.8.7 to 2.2 or 2.1:

  • Use new lambda syntax: change lambda { |x| ... } to ->(x) { ... }. You can probably fix these with Rubocop’s --auto-correct. See my rant about Add Rubocop to every Rails project
    • Remove gem parallel_tests. Spring will take care of most of your rspec slowness going forward.

    • Upgrade sanitize gem to 4+.

    • gem ruby-debug should be removed or replaced with byebug

    • Remove gem mysql with mysql2

    • Remove gem fastercsv. Migrate to something like roo

    • Update gem capistrano 2.12.0 to ~>2.12. You should also get rid of dependencies for net-scp and net-ssh if they are in your Gemfile.

    • Upgrade i18n gem. Make sure it is latest as there are known problems with below version 0.7.0.

    • Remove gem oniguruma

    • Remove gem parallel_tests. Spring will take care of most of your rspec slowness going forward.

    • fix incompatible character encodings: UTF-8 and ASCII-8BIT. Use Encoding.default_external = Encoding::UTF_8 and Encoding.default_internal = Encoding::UTF_8

    • Do a grep in your app/views and app/helpers for calls the Rails builtin helper truncate. The method parameters changed from an integer to a hash: truncate('hello, world', 5) is now truncate('hello, world', length: 5)

This list is still a work in progress and includes no warranty.