Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I choose Ruby version on Heroku?

Tags:

I use Ruby 1.9.x syntax in my Rails 3 app, but after pushing it to Heroku it crashes due to older Ruby version (1.8). How can I control it?

like image 255
Andrei Avatar asked Aug 31 '10 23:08

Andrei


2 Answers

Heroku's current stack, Cedar, uses 1.9.2 by default. Cedar also supports specifying the Ruby version in your Gemfile. Currently, 1.9.2 and 1.9.3 are valid options.

# Gemfile
source "https://rubygems.org"
ruby "1.9.3"
...

More details are available in the Ruby support article: https://devcenter.heroku.com/articles/ruby-support


If you are currently using Aspen or Bamboo, you can switch to 1.9.2 by using the stack:migrate command:

$ heroku stack:migrate bamboo-mri-1.9.2

You cannot automatically migrate to the Cedar stack at this time, but there is a guide on how to do so: https://devcenter.heroku.com/articles/cedar-migration

like image 115
wuputah Avatar answered Oct 21 '22 19:10

wuputah


You can now explicitly specify a Ruby version on Heroku.

Simply setup your Gemfile as so

# Gemfile
source "https://rubygems.org"
ruby "1.9.3"

# Gems go here
like image 21
mshafrir Avatar answered Oct 21 '22 20:10

mshafrir