Note: Before upgrading your Rails app, always make sure to save your code on a version control system, such as Git.
To upgrade from Rails 4.2 to Rails 5.0, you must be using Ruby 2.2.2 or newer. After upgrading your Ruby version if required, go to your Gemfile and change the line:
gem 'rails', '...