Ruby and gems versions in the Gemfile

The Ruby on Rails Tutorial
https://www.railstutorial.org/book/frontmatter
by Michael H. uses a Gemfile without specifying a Ruby version: the
ruby
keyword is missing in all the applications.

When I deploy to Heroku I receive the following warning:

remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby ‘2.2.4’
remote: # See https://devcenter.heroku.com/articles/ruby-versions
for more information.

The tutorial says
https://www.railstutorial.org/book/sign_up#sec-ruby_version_number
that “the
costs associated with including such an explicit Ruby version number
outweigh the (negligible) benefits, so you should ignore this warning
for
now. The main issue is that keeping your sample app and system in sync
with
the latest Ruby version can be a huge inconvenience
”.

I am wondering what is better (if I can choose), between using the same
Ruby version at Heroku and specifying any Ruby version it suits me.
Since I
am using Ruby 2.2.1p85 for my application, adding ruby “2.2.1”,
:patchlevel
=> “85” would work and make Heroku adjust to this version or rather I am
supposed to adjust to Heroku and add as suggested ruby ‘2.2.4’? Can I
leave
out the Ruby version with no worries?

I am using rvm and a specific gemset with a specific Ruby version, for
no
other reason than trying to use an environment as much close to the
tutorial as possible.

How can I decide what Ruby version and what version of the gems in the
Gemfile are suitable for my application?

I prefer keeping ruby version in Gemfile even when I do not use Heroku

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs