sameera207
sameera207

Reputation: 16629

creating a new rails project in rails 2.2.2 (while having rails3)

In my computer (linux - ubuntu) I have installed rails 2.2.2 and rails 3

Now i want to create a project in rails 2.2.2. (Like rails ). But it asks to enter the rails command as in rails 3 (like rails new )

when i type rails -v it shows the rails version as 3. But in my gem list it has both rails 2.2.2 and 3

how can i create a project in rails 2.2.2

thanks in advance

cheers

sameera

Upvotes: 2

Views: 664

Answers (4)

Haftom Berhe
Haftom Berhe

Reputation: 11

When you want to specifically use one version of your installed version for a specific project use

rails _2.2.2_ (your project)

Upvotes: 1

Sergey
Sergey

Reputation: 795

There are 3 easiest ways how to manage it:

0) remove not used version of rails

1) rails is just simple command, so each time when you need to run special version of it you can specify full full path to it( or alias it one time)

2) if you strongly need to have different types/versions of ruby environments( and/or different versions of ruby gems such as rails), I recomend you to use rvm - it is the most easiest way to manage it.

Upvotes: 1

Shreyas
Shreyas

Reputation: 8757

You can do this. Create a rails project.

rails myproject

Go to your envirnonment file and modify to

RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION

EDIT

Yes , Sorry about that .This method may have worked in rails versions < 3. My Bad ! RVM the way to go.

Should do the trick. Also I recommend you update to atleast Rails 2.3.9, in case you don't want to start off with Rails 3.

Upvotes: 1

tommasop
tommasop

Reputation: 18765

Generally speaking if you have two versions of ruby and rails installed the last one will be the "normal" one using "normal" commands like:

ruby
rails
gem

For all the other versions you can define (or have defined during installation) some aliases like:

ruby187
rails222
gem222

Another solution could be this

Or the best solution I recommend for working with multiple ruby and rails versions is RVM

Upvotes: 2

Related Questions