This article introduces how to change Rails versions in the Ruby programming language.
When doing rails new, you may need to specify a version.
For example, in the rails tutorial, you need notation like rails 4.2.2 new sample_app.
At this time, if rails 4.2.2 is not installed, an error will occur.
To install rails with a specified version, use the following:
gem install rails -v 4.2.2
Check how many versions are installed
gem search ^rails$ -l
Then, this happens
PS Y:\files\pg\railsenv\sample_app> rails -v
Expected string default value for '--rc'; got false (boolean)
Rails 4.2.2
PS Y:\files\pg\railsenv\sample_app> cd ..
PS Y:\files\pg\railsenv> rails -v
Rails 5.1.1