When upgrading our apps between Rails major and minor versions, follow the official Rails guides
Gotchas for upgrading to Rails 5.0
By default Rails 5 disables autoloading in production and uses eager load, this blog post explains further.
The effect this can have is that classes that need the
autoload_paths altered -
for instance at the root of
lib - will no longer work in production, but will
still load in development (this has already caused a production issue).
The solution is append to
eager_load_paths rather than
will ensure the classes are loaded in both production and development. See
Publishing API Example.
Upgrading to Rails 5 requires upgrading the Airbrake gem to avoid deprecation warnings about middleware. However, Airbrake 5 breaks some compatibility with our Errbit installation, namely that deployments are no longer recorded.
Instead of upgrading to a released version of the Airbrake 5 gem you can use a branch in our fork of Airbrake. This is 4.3.8 of the gem with a small change to silence the warnings:
gem 'airbrake', github: 'alphagov/airbrake', branch: 'silence-dep-warnings-for-rails-5'
Don’t include ActionCable or Puma configs
We don’t use these in production and are likely to cause conflicts.
Gotchas for upgrading to Rails 5.1
Schema dumper changes
The schema dumper has been refactored in Rails 5.1 so the first migration after upgrading
will generate a lot of differences in
Notably whitespace and
using :btree index modifiers.
See this commit
and also this commit for details of the changes.
As part of the upgrade, regenerating the schema with
rake db:migrate and including the updated
db/schema.rb file will mean
the next migration doesn’t generate this noise.