Choosing a Rails Version

The previous instructions helped you install the version of Rails used by the examples in this book. But occasionally you might not want to run that version. For example, a newer version with some fixes or new features might become available. Or perhaps you’re developing on one machine but intending to deploy on another machine that contains a version of Rails that you don’t have any control over.

If either of these situations applies to you, you need to be aware of a few things. For starters, you can use the gem command to find out all the versions of Rails you have installed:

 $ ​​gem​​ ​​list​​ ​​--local​​ ​​rails

You can also verify which version of Rails you’re running as the default by using the rails --version command. It should return 6.0.1.

If it doesn’t, insert the version of Rails surrounded by underscores before the first parameter of any rails command. Here’s an example:

 $ ​​rails​​ ​​_6.0.1_​​ ​​--version

This is particularly handy when you create a new application, because once you create an application with a specific version of Rails, it’ll continue to use that version of Rails—even if newer versions are installed on the system—until you decide it’s time to upgrade. To upgrade, simply update the version number in the Gemfile that’s in the root directory of your application and run bundle install.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.186.201