Fixing Rails deployment errors with Capistrano

After upgrading a Rails web application from Rails 4.2 to Rails 5.0 and attempting to deploy it using Capistrano, I got stuck on “Your Ruby version is 1.9.3, but your Gemfile specified 2.3.1” errors that gave me quite a headache – but the solution is really simple.

This is a companion discussion topic for the original entry at