I have multiple versions of the Rails gem installed on my development server. We’ve been using Rails long enough now that we have many apps created for many versions. As I make changes to each app I need to test them in their specific version (the version listed in the environment.rb file) so having multiple Rails versions installed is a necessity.
But if I try to spin up a new application using
$rails new_app
I get a rails app created specifically for the latest version of Rails installed.
But what if you need to create a new app for an older version of rails that is also installed? The following easy command does the trick:
$rails _1.2.3_ new_app
Where 1.2.3 is the desired version of Rails I want new_app to run. Note the underscores before and after the version.