开发者

Can I use different versions of rails in the same machine?

I am currently analyzing two rails project one of them is in version 2.3.5 and the other one is in version 2.3.4. How can I run both the 开发者_StackOverflow社区projects in the same machine?


I use Ruby Version Manager (RVM), http://beginrescueend.com/.

It lets you install multiple ruby environments in your home directory. You can also create multiple 'gemsets' specific to each of your 'rubies'.

Now all of your gems, Rails especially, can exist in their own safe environments. You simply switch between each of them. Very very very awesome.

EDIT

It appears in your comment to your question that you're using windows...so looks like RVM won't work. The RVM site recommends PIK: http://github.com/vertiginous/pik as a windows alternative.


It's just a question of gems. Bundler handles this for you so there should't be any difficulty.

Detail your question if you face a stumbling block.


You can specify which version do you want to use in your project in your config/environment.rb file:

RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

Or pass it straight:

ruby script/console RAILS_GEM_VERSION='2.3.5'

So you can run both of them:

# on http://localhost:3000
ruby script/console RAILS_GEM_VERSION='2.3.4' -p 3000
# on http://localhost:3001
ruby script/console RAILS_GEM_VERSION='2.3.5' -p 3001
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜