Skip to content

Instantly share code, notes, and snippets.

@EmanuelCadems
Last active September 2, 2018 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmanuelCadems/150276111cd2dfc02f02ceb413d306ce to your computer and use it in GitHub Desktop.
Save EmanuelCadems/150276111cd2dfc02f02ceb413d306ce to your computer and use it in GitHub Desktop.
# This example is going to show you how to use different versions of rails with a specific version of ruby
# 1. Select your ruby version
rvm use 2.5.1
# 2. Create a gemset for your specific version of rails. The basic approach is to use one gemset per project.
rvm gemset create my_project_in_rails_4
# 3. Check that your gemset was created with:
rvm gemset list
# 4. Select your gemset with:
rvm gemset use my_project_in_rails_4
# 5. Install your specific vesrion of rails. In this case 4
gem install rails -v='4.2.0'
# 6 create your rails app
rails new my_project_in_rails_4
# 7. Finally you may want to save time selecting your ruby version and gemset automatically. In order to do that you can
# create 2 hidden files wich tells your console which ruby version and gemset you want to use
echo 'ruby-2.5.1' >> my_project_in_rails_4/.ruby-version
echo '@my_project_in_rails_4' >> my_project_in_rails_4/.ruby-gemset
# 8 That's all! Then every time you enter inside your project you will have the right version of ruby and gemset.
# You can check this out running:
rvm list
rvm gemset list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment