views:

56

answers:

2

I've just upgraded my rails version to rails 3.0. But suddenly I need a new rails app with old version of rails. I know the new version of rails change command line usage with 'rails new'. How can I create an old version of rails in this new rails 3 environment??

A: 

If you need to switch back and forth, I would recommend using RVM. You can install different versions of Ruby and each can have its own set of gems. I use my system installed ruby (1.8.6?) on my Mac for Rails 2 dev, and then I installed Ruby 1.9.2 with RVM for my Rails 3 dev. Its as simple as doing this after you have RVM installed:

#install and use 1.9.2 for Rails 3
rvm install 1.9.2
rvm 1.9.2
rails new whatever

#switch back to system installed ruby for Rails 2
rvm system
rails whatever
cowboycoded
+1  A: 

Leonid Shevtsov provided instructions for how to do this here.

The easiest way to do it was:

  1. Create the directory for the project

  2. Create a Gemfile there containing

    gem "rails", "2.3.9"

    gem "sqlite3-ruby", :require => "sqlite3"

  3. Runbundle install

  4. Run bundle exec rails . to create an app in the current path

You don't even need rvm to do this.

vonconrad