开发者

Can I have/use different Versions of rails in the same machine

I am actually reading a rails book that is written for rails 2.3.5. I want to test Rails 3 beta as well. Is it possible to have such a setup in my Mac OS leopard?

I have tried with gem list -d rails. There are many versions stored in my mac but I don't know how to use different versions of rails while cr开发者_StackOverfloweating applications using rails command


While RVM is great there's no need for it in this use-case.

Install the Rails 3 gem: gem install rails—pre

Create new project: rails project_name (this will use the latest version installed)

To create projects with a specific version: rails _2.3.5_ project_name


Yes! Try rvm. It is awesome, you can have many different versions of Ruby, and for each one you can have different versions of gems. And you can run the same tests on all those versions. Isn't that cool?!

Quick How-To:

$ rvm install ruby-1.8.7 --default
$ gem install rails -v 1.0.0
$ rvm gemset create rails238
$ rvm 1.8.7@rails238
$ gem install rails -v 2.3.8

Now,

$ rvm 1.8.7

will give you ruby 1.8.7 and rails 1.0

And,

$ rvm 1.8.7@rails238

will give you ruby 1.8.7 and rails 2.3.8

You can make 2.3.8 as default one with

$ rvm use 1.8.7@rails238 --default

BTW rvm is documented really good.


The way to do this anymore is to use RVM, the Ruby Version Manager, which isolates different Ruby environments from each other.

A coworker of mine did a blog entry on setting up Rails 3 and RVM (and Ruby 1.9), which you might find interesting.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜