Bundler's New Ruby Version File Option

August 18, 2023

Track your progress

Sign in to track your progress and access subscription-only lessons.

Log In

Your Teacher

Hi, I'm Chris. I'm the creator of GoRails, Hatchbox.io and Jumpstart. I spend my time creating tutorials and tools to help Ruby on Rails developers build apps better and faster.

About This Episode

Bundler 2.4.19 introduces a new "file:" option for specifying the Ruby version file. This makes it easy for you to have a single point of truth for your Ruby version file.

Notes

Bundler 2.4.19 released a new option for specifying the file to load the Ruby version from. This is handy because we already have .ruby-version for our Ruby Version Managers like ASDF, rbenv, chruby, and rvm. Now Bundler can use the same file for specifying the Ruby version.

To get the latest bundler, run

gem update --system

In your Gemfile, you can change to the following:

ruby file: ".ruby-version"

Unfortunately, Heroku doesn't allow you to specify Bundler versions, so you will need to read the file manually instead.

ruby File.read(".ruby-version").strip

Want to stay up-to-date with Ruby on Rails?

Join 83,038+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.