Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to specify the Ruby version in a Rails app, using RVM, that will be deployed on Heroku?

Tags:

ruby

heroku

rvm

The RVM Best Practices state that, to connect a project to a specific Ruby version, you should specify that version in the project-specific rvmrc file.

This SO answer states that, in most situations, you should use specify the Ruby version in the .ruby-version file.

Heroku says you should specify the Ruby version in Gemfile.

What is the correct way to specify a Ruby version, using RVM, if the app will be deployed on Heroku?

like image 795
ben Avatar asked Mar 22 '23 10:03

ben


2 Answers

.rvmrc is deprecated and you should use .ruby-version instead.

But Heroku does not pay attention to the .ruby-version. Heroku wants to have it in the Gemfile. So I think you should use both: .ruby-version (for you) and Gemfile (for Heroku).

like image 78
spickermann Avatar answered Mar 25 '23 01:03

spickermann


You need to place it in the Gemfile for Heroku's sake, but if you're using a version manager, then you'll need to use something else for the sake of the version manager. I think the SO answer makes sense in that regard (i.e. the .ruby-version file).

like image 32
Peter Alfvin Avatar answered Mar 24 '23 23:03

Peter Alfvin