Ruby on Rails5 quick learning practice guide that can be used in the field Chapter3-1-3
$ rails _5.2.1_ new taskleaf -d postgresql
I created the app by specifying the version in, but when I started the server, the version of rails became 5.2.4.4.
Matching the versions of Gemfile and Gemfile.lock and starting the server will result in rails version 5.2.1
Since the version is described in Gemfile.lock, when I looked at it, the version of rails was still 5.2.4.4. On the other hand, Gemfile
Gemfile
gem 'rails', '~> 5.2.1'
So why are the versions of Gemfile and Gemfile.lock different? I thought.
As I investigated, I found that the cause was the gem ‘rails’, ‘~> 5.2.1’ part in the Gemfile.
Since gem'rails','~> 5.2.1'
represents gem'rails','> = 5.2.1', <5.3.0'
, the version of Gemfile.lock is 5.2.4.4. It was closed.
In order for Gemfile.lock to be 5.2.1, it was necessary to specify gem ‘rails’ and ‘5.2.1’
exactly in Gemfile.
Gemfile
gem 'rails', '5.2.1'
Correct to
$ bundle update
The version is now specified correctly!
Recommended Posts