RVM made my life easier to run multiple versions of ruby and rails in Ubuntu/Mac OS.
If we want to maintain multiple versions of gem under a single ruby version, we can create a named gemsets for different versions and switch between them easily.
What is the advantage?
Answer: You can maintain multiple versions of Ruby as well as Rails (or gems). Cool. Isn’t it?
The below command creates a gemset named gemsetname.
[source=’ruby’]
#rvm 1.9.2@gemsetname –create
rvm 1.9.2@railspre –create
[/source]
gemset name can be anything meaningful related to the gem version
eg : railspre, rails307,rails234
[source=’ruby’]
rvm gemset list # lists all the gemsets under ruby version 1.9.2
gemsets for ruby-1.9.2-p180 (found in /home/spritle/.rvm/gems/ruby-1.9.2-p180)
global
rails30
rails31
=> railspre
[/source]
[source=’ruby’]
$ rvm 1.9.2-head@railspre
$ ruby -v
$ ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
$ rails -v
$ Rails 3.1.0.rc4
[/source]
So first I am selecting rails pre version and when I check the version it shows up rails 3.1, now I am switching to gemset rails307, after switching I am checking the verison and now its rails 3.0.7
[source=’ruby’]
$ rvm 1.9.2@rails307
$ rails -v
$ Rails 3.0.7
[/source]