Last Updated: June 15, 2017
· lazybios

Specify Ruby version in Gemfile

Does your app need to set a dependency on your Ruby version? Want to make sure the Ruby versions on your development and production servers are the same? Want your app to fail faster if the wrong version of Ruby is installed? Just specify what version you want to use in your gemfile using the ruby directive.

ruby "<ruby version>",
  :engine => "<ruby implementation>",
  :engine_version => "<ruby implementation version>"

For example, if you wanted to use Ruby 1.9.3 powered by JRuby you can do the following:

ruby "1.9.3",
  :engine => "jruby",
  :engine_version => "1.6.7"

Note: The ruby directive explicitly leaves out the ability to specify a patch level. Ruby patches often include important bug and security fixes and are extremely compatible.