简体   繁体   中英

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

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

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.

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.

当您想将已安装版本的一个版本专门用于特定项目时

rails _2.2.2_ (your project)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM