开发者

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 ve开发者_如何学编程rsion 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.


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

rails _2.2.2_ (your project)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜