Upgrading a Rails 3.2 application to Ruby 2.1 is really easy

Posted Over 9 years ago. Visible to the public.

Upgrading from Ruby 1.8.7 to 2.1.2 took me an hour for a medium-sized application. It involved hardly any changes except

  • removing the occasional monkey patch where I had backported functionality from modern Rubies
  • Migrating from require to require_relative where I loaded RSpec factories in Cucumber's env.rb (the Rails application root is no longer in the load path by default)
  • replacing the old debugger with byebug
  • removing sytem_timer from Gemfile (see this SO thread Show archive.org snapshot for details)
  • If you get LoadError: cannot load such file -- iconv: Add gem 'iconv' to your Gemfile. iconv is a part of Ruby that was removed in 2.0. Rails 3 seems to depend on it.

All the pain with magic # encoding: utf-8 comments is gone since UTF-8 is a default encoding in Ruby 2+.

Henning Koch
Last edit
Over 9 years ago
Dominik Schöler
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2014-11-19 07:44)