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 18.104.22.168.
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 22.214.171.124. On the other hand, 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.
gem'rails','~> 5.2.1' represents
gem'rails','> = 5.2.1', <5.3.0', the version of Gemfile.lock is 126.96.36.199. 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.
gem 'rails', '5.2.1'
$ bundle update
The version is now specified correctly!