Reputation: 29817
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?
Upvotes: 4
Views: 165
Reputation: 53188
Check https://rvm.io/workflow/projects - it says you can use Gemfile
to specify ruby version for RVM like this:
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 also with other ruby environment managers like chruby
Upvotes: 1
Reputation: 107142
.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).
Upvotes: 4
Reputation: 29439
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).
Upvotes: 2