I have installed rails 3.0.10 and 2.3.5 in my machine. I wanna shuffle between them but I am unable to use 2.3.5. When I run a command, the system recognizes only 3.0.10.

- 37,420
- 30
- 139
- 188

- 44,892
- 25
- 73
- 103
-
Specifying a version of Rails in the Gemfiles of your different projects should suffice. For more advanced Ruby/Gem version management, check out [rvm](https://rvm.beginrescueend.com/) – cmpolis Aug 25 '11 at 18:29
2 Answers
rvm lets you easily manage multiple installs of Ruby, each with their own list of gemsets.
Edit: Based on your comment about looking into gemsets, I'll point out one of the single coolest features with rvm. Once you get your gemset setup, create a .rvmrc
file in your Rails root directory. Add the following to it:
rvm 1.9.2@foo
Where "1.9.2" is whatever Ruby you're using and "foo" is the gemset name. rvm will automatically start using this set when you cd in to that directory.

- 17,702
- 4
- 51
- 54
-
-
-
Short answer: don't. You don't want anything on your system corrupting your pristine gemset sandbox. It defeats the entire purpose of them. – jdl Aug 25 '11 at 18:47
-
@jdl: Hi, you are saying about managing multiple versions of ruby. But the question is about rails. right? Can you please suggest a way by which we can easily shuffle rails versions like RVM does it for ruby. – Rajesh Omanakuttan Dec 15 '12 at 05:15
-
It's both. The gemset would contain whatever version of Rails you wanted to use. A different gemset could contain a different version of Rails, etc. – jdl Dec 16 '12 at 15:47
Definitely use rvm, create a .rvmrc file in the root directory of each of your projects.
For rails 3 stuff, it should contain a single line: rvm 1.9.2@projectName
Replacing projectName with an identifier for your project. Then use rvm gemset create projectName
Everytime you go into that directory, you'll be using that version of ruby with that particular gemset so you won't mix up versions or ruby or gems!

- 912
- 1
- 9
- 14
-
So for using different versions of rails, i should have different versions of ruby too and should create appropriate gemset for each one.. Is that what u mean? – Rahul Aug 25 '11 at 18:41
-
I make a gemset for each project... assuming a project will only use one version of ruby. The Gemfile for each project specifies which version of rails to use, so each project will be running its own, independent version of rails. The .rvmrc file lets RVM know which version of Ruby you want to use with each project. – Greg Olsen Aug 25 '11 at 18:44