before we go • Read A Guide for Upgrading Ruby on Rails http:// guides.rubyonrails.org/upgradingrubyon_rails.html • Is the test code sufficient? • Upgrade to latest version
1. $ rails app:update • executes $ rails app:update • protip you can specify THOR_DIFF for checking diff. see also: http://qiita.com/ma2ge/items/ a838864f059fc9b931b2 • check the difference • I recommended to use railsdiff.org. http://railsdiff.org/
2. $ bundle install • perhaps it fails first or again and again • solve the dependency problems something like the following • update gems suitable for your new Rails version • if there's nothing for suitable version you can make a pull request or fork • etc...
paranoia gem [1/2] • https://github.com/rubysherpas/paranoia • caught the error fix `ArgumentError: wrong number of arguments (given 3, expected 4)` • this bug was fixed on https://github.com/rubysherpas/ paranoia/pull/384
Cannot add foreign key constraint [3/4] class CreateXxx < ActiveRecord::Migration[5.1] def change create_table :xxx do |t| t.references :yyy, foreign_key: true t.string :name end end end
Cannot add foreign key constraint [4/4] # plan 1 +class CreateXxx < ActiveRecord::Migration[5.0] -class CreateXxx < ActiveRecord::Migration[5.1] # plan 2 + t.references :yyy, foreign_key: true - t.references :yyy, type: :integer, foreign_key: true # plan 3 change all old migration to 5.1 if you are developing new project