Ruby version in gemfile

Michael Hartl's Ruby on Rails tutorial uses the Gemfile without specifying the Ruby version: the keyword is rubymissing in all applications.

When I deploy to Heroku, I get 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 textbook says that β€œthe costs of including such an explicit Ruby version number outweigh the (minor) benefits, so you should ignore this Warning for now. The main problem is that keeping the sample application and system in sync with the latest version Ruby can be a huge inconvenience. "

I am wondering if it is worth keeping up with the Heroku Ruby version (presumably 2.2.4 at present), as it seems in the book, or indicate any Ruby version that suits me. In other words, since I am using Ruby 2.2.1p85 for my application, ruby "2.2.1", :patchlevel => "85"will the addition work and get Heroku to adapt to this version, or, rather, should I adapt to Heroku and add as suggested ruby '2.2.4'?

I also use a rvmspecific gemset with a specific version of Ruby, for no other reason than to try to use an environment as close to the tutorial as possible. What is best practice in a real context? Would you suggest using the latest version of Ruby and including it in the Gemfile? Can Gemfile leave the Ruby version without problems?

+4
2

, , , ruby

heroku run "ruby -v"

ruby 2.2.4. ruby 2.2.4, .

/ . ruby Gemfile, Ruby.

source "https://rubygems.org"
ruby "2.2.4"

.

$ gem install bundler
$ bundle update
+4

:

heroku run rake db:migrate

0

All Articles