How to set default rails version for a project?
I couldn't get matkins' answer to work via RailsInstaller on Windows 7, so I thought I'd post my solution for someone else to benefit from: (I don't have the reputation to offer this as a comment so I'm adding a new answer)
c:\>rails -v
Rails 4.0.0
c:\>rails _3.2.8_ app1 &REM This is going to bug out
Instead, I found this works:
c:\>rails _3.2.8_ new app1 &REM This will work
To use an older version than the latest you have installed, just wrap the version number in underscores:
rails _1.2.1_ myproject
The URL you posted solves your problem - you simply forgot the underscores.
varar:~ mr$ gem list rails
*** LOCAL GEMS ***
rails (3.1.0.rc1, 3.1.0.beta1, 3.0.3, 3.0.1)
varar:~ mr$ rails _3.0.1_ -v
Rails 3.0.1
As @Shaun mentioned in this post, you can use multiple versions of Rails and Ruby in same time!
For using an specific version of ruby:
rvm use 1.9.3 --default
Switch --default
is used for setting this version as Ruby default version.
For using an specific Rails and Ruby version:
rvm gemset create rails-3.2.3
rvm use [email protected] --default
gem install rails
First line creates a gemset and related folder under /home/username/.rvm/gems/
Second line use that gemset as default one
Third line install specified version in gemset (Rails 3.2.3) on related folder.
This is my gems
folder's contents:
cache ruby-1.9.3-p194 ruby-1.9.3-p194@global [email protected]
Initial folder is ruby-1.9.3-p194@global
. Therefore for backing to previous state, just run:
rvm use 1.9.3@global
and you can see previous Rails and Ruby versions :)
Good luck