Two Rails versions on the same computer?

Can I install two different Rails versions on the same computer (without using a virtual machine)? I want to switch back and forth easily between Rails 1.2.3 and Rails 2.0.2. I assume that if I try to gem-install a second version, there will still be only one rails file in my ruby\bin directory. How to resolve the two versions? I’m alternately using the command line, RadRails, and 3rd Rail.

Thanks.

Barry Burd wrote:

Can I install two different Rails versions on the same computer (without using a virtual machine)? I want to switch back and forth easily between Rails 1.2.3 and Rails 2.0.2. I assume that if I try to gem-install a second version, there will still be only one rails file in my ruby\bin directory. How to resolve the two versions? I'm alternately using the command line, RadRails, and 3rd Rail.

As far as the app goes, just set the GEM version in environment.rb. For the commandline tool, try renaming the rails binary to something else such as rails2 and then install the other version of the gem.

-matthew

Can I install two different Rails versions on the same computer (without using a virtual machine)?

Yes. As many until your heart is content.

I want to switch back and forth easily between

Rails 1.2.3 and Rails 2.0.2. I assume that if I try to gem-install a second version, there will still be only one rails file in my ruby\bin directory.

Say you have both 1.2.3 and 2.0.2 installed and you want to create a new 1.2.3 app.

you can: "rails _1.2.3_ newapp"

if you are working with applications that exist already, just set the gem version in environment.rb

RAILS_GEM_VERSION="1.2.3"

HTH

The basic pieces to take into account here are:

* Several versions of the same gem can be installed without problem, RubyGems provides ways to refer to them if needed

* If Rails was frozen under vendor/rails that's the one used unconditionally, you can even run that application without a system-wide rails installed, it is self-contained in that sense

* Otherwise if RAILS_GEM_VERSION is uncommented in environtment.rb that specific version of the gem is the one loaded

* Otherwise the rails gem is loaded without a version constraint

-- fxn

As a heads up...

If you are using RAILS_GEM_VERSION="1.2.3" in environment.rb

and you have both 1.2.3 and 2.0.2 installed ..

if you use "script/console" you will more than likely get a message that you are using rails 2.0.2

Don't let that confuse you, your applications will be using what you specify in environment.rb

Barry Burd wrote:

Can I install two different Rails versions on the same computer (without using a virtual machine)? I want to switch back and forth easily between Rails 1.2.3 and Rails 2.0.2.

In addition to the approaches suggested by other responders, if you're running on Windows you should consider Instant Rails. I've found it to be the least complicated, least error-prone solution to the problem you're working.

Best regards, Bill