[RUBY] About rails version specification

Corresponding part

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

Expected behavior

Matching the versions of Gemfile and Gemfile.lock and starting the server will result in rails version 5.2.1

What I worked on

Since the version is described in Gemfile.lock, when I looked at it, the version of rails was still 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. Since gem'rails','~> 5.2.1' represents gem'rails','> = 5.2.1', <5.3.0', the version of Gemfile.lock is 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'

Correct to

$ bundle update

The version is now specified correctly!

Recommended Posts

About rails version specification
About Rails 6
About Rails routing
[Rails] About ActiveJob ,!
About Rails controller
About RSpec (Rails)
[Rails] About migration files
[Rails 6] About main gems
[Rails] About active hash
About rails application server
Rails version upgrade memorandum 5.0 → 5.1
MEMO about Rails 6 series
[Rails] About Slim notation
[Rails version control] rails version downgrade
[rails] About devise defaults
Rails: About partial templates
About rails strong parameters
[Beginner] About Rails Session
about the where method (rails)
[Ruby on Rails] about has_secure_password
About naming Rails model methods
[Rails] About scss folder structure
[Rails] Rails version upgrade error memorandum
[Rails] About Rspec response test
About Rails scraping method Mechanize
[Rails] About the Punk List function
About the symbol <%%> in Rails erb
[Rails] About implementation of like function
[Grover] Generate PDF with Rails [2020 version]
[Rails] About helper method form_with [Basic]
About =
Project ruby and rails version upgrade
Consideration about Rails and Clean Architecture
About the version of Docker's Node.js image
[Ruby on Rails] About bundler (for beginners)
[Rails 6.0] About batch saving of multiple records
[Ruby on Rails] About Active Record callbacks
[Rails] About local: true described in form_with
[Japanese version Faker] About the gem "gimei"
Rails: A little summary about data types
[Vue.js] Implementation of menu function Implementation version rails6