1

I have a rails 5.1 app, here is my .ruby-version

ruby-2.5.0

Here is the output of rvm list

rvm rubies

   ruby-2.3.1 [ x86_64 ]
=* ruby-2.4.0 [ x86_64 ]
   ruby-2.5.0 [ x86_64 ]

When I cd to "current" (deployed using Capistrano) I and I run the following:

RAILS_ENV=production bundle exec ruby --version

I get

ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

I thought .ruby-version was what triggers which ruby version is used. What am I doing wrong?

user1130176
  • 1,772
  • 1
  • 23
  • 33

2 Answers2

2

If you plan on using 2.5..0 as the default ruby version for your app run this on the server

rvm use --default 2.5.0

Its giving you 2.4.0 because its set up as the default and current ie =* means it is what will be used.

Also since you are deploying with capistrano and are using rvm you should consider using this gem.

https://github.com/capistrano/rvm

iamcaleberic
  • 913
  • 8
  • 12
0

Per the docs you can set the ruby version explicitly, it also may likely be your server - for instance if you are using nginx you have to explicitly state your path in the nginx config file to your ruby version - but that all depends on your production configuration

https://rvm.io/rubies/default

$ rvm --default use 2.1.1

$ ruby -v

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
alilland
  • 2,039
  • 1
  • 21
  • 42