Rails Upgrade Cheatsheet - Paprikas/rails_cheat_sheet GitHub Wiki

Finding warnings

Insert to application.rb before Bundler.require(*Rails.groups) or require as lib

# lib
if defined?(Bundler)
  ...
  require_relative '../lib/warning_handlers/ruby'
  ...
end
module WarningHandlers
  module Ruby
    class Warning < StandardError; end

    def warn(message)
      exception = Warning.new(message)
      raise exception # Or send to a notification system
    end
  end
end

Warning.singleton_class.prepend(WarningHandlers::Ruby)

Upgrading groups

bundle update --group development

Patch level. See more in bundler docs.

  • --patch: Prefer updating only to next patch version.

  • --minor: Prefer updating only to next minor version.

  • --major: Prefer updating to next major version (default).

  • --strict: Do not allow any gem to be updated past latest --patch | --minor | --major

    #  Command Line                     Result
    ------------------------------------------------------------
    1  bundle update --patch            'foo 1.4.5', 'bar 2.1.1'
    2  bundle update --patch foo        'foo 1.4.5', 'bar 2.1.1'
    3  bundle update --minor            'foo 1.5.1', 'bar 3.0.0'
    4  bundle update --minor --strict   'foo 1.5.0', 'bar 2.1.1'
    5  bundle update --patch --strict   'foo 1.4.4', 'bar 2.0.4'