You can install an older version of rails using this syntax:
rails _5.1.6_ new my-test-app
(Where “5.1.6” is the version you want and “my-test-app” is the name of your new rails app.)
Yes, you actually type those underscores around the version number.
If you get …
can’t find gem railties (>= 0.a) (Gem::GemNotFoundException)
You probably don’t have the right version of Rails itself installed as a gem; try this:
rails install -v=5.1.6
or…
gem install rails -v 5.1.6
Then try again with…
rails _5.1.6_ new my-test-app