What is the correct way to specify the version of Ruby in a Rails application using the RVM to be deployed to Heroku?

RVM Best Practices claims that in order to connect a project to a specific version of Ruby, you must specify this version in a specific rvmrc project.

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

Geroku says you must specify the version of Ruby in the Gemfile .

What is the correct way to specify a version of Ruby using RVM if the application is deployed to Heroku?

+4
source share
3 answers

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

But Geroku pays no attention to the .ruby-version . Heroku wants to have it in the Gemfile . Therefore, I think you should use both: .ruby-version (for you) and Gemfile (for Heroku).

+4
source

You need to put it in the Gemfile for Heroku, but if you use the version manager, you will need to use something else for the version manager. I think the SO answer makes sense in this regard (i.e. .ruby-version file).

+2
source

Check out https://rvm.io/workflow/projects - it says that you can use the Gemfile to specify the ruby ​​version for RVM as follows:

 ruby "1.9.3" 

or something more complicated:

 ruby File.readlines(".ruby-version").first.strip 

and then in .ruby-version :

 1.9.3 

this way it will work with other Ruby environment managers like chruby

+1
source

Source: https://habr.com/ru/post/1502079/


All Articles