Today I Learned

hashrocket A Hashrocket project

Create New Rails App with Old Rails Version

Sometimes you need to spin up a rails app using an older version of rails. Running rails new will spin up an app with the latest version (which is what you want most of the time). But if you have older gems of rails installed you can create new rails apps by specifying the version wrapped in underscores.

Say your rails entry in your gem list looks like this: rails (7.2.2.2, 7.2.1, 7.1.5.2, 7.1.2, 7.0.8.7). If you want to create a new rails app using 7.0.8.7, you can run (_ before and after the version number!):

$ rails _7.0.8.7_ new new_app

And boom, you've got a new_app created running rails 7.0.8.7.

See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.