多个项目的多个Rails版本 [英] Multiple Rails versions for multiple projects

查看:73
本文介绍了多个项目的多个Rails版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Rails 2.2.2用于一个项目,将Rails 2.3.2用于另一个项目.两者都已安装.

I'd like to use Rails 2.2.2 for one project and Rails 2.3.2 for another. Both are installed.

rails _2.2.2_ --version应该做什么?我读过它使2.2.2可以正常工作了,也就是从那时起将要使用的版本.但是,当我检查rails --version时,就会得到Rails 2.3.2.因此,我也想知道rails --version告诉我什么;只是我拥有的最新版本的Rails还是将用于rake s的版本?

What is rails _2.2.2_ --version supposed to do? I've read that it makes 2.2.2 the working version -- that is, the version that will be used from that point on. But when I check rails --version, I get Rails 2.3.2. So, I also want to know what rails --version tells me; is it just the latest version of Rails that I have or is it the version that will be used for rakes?

我了解RVM.这是在不同项目上使用不同版本的Rails的最佳方法吗?

I know about RVM. Is that the best way to use different versions of Rails on different projects?

推荐答案

是的,"rails --version"告诉您最新版本的rails.如果要检查安装在计算机中的Rails的不同版本,则必须执行宝石列表",该列表会列出计算机中安装的所有gem的列表及其版本.例如:-

Yes "rails --version" tells which is the latest version of rails. If you want to check different versions of rails installed in your machine you have to do "gem list" which gives the list of all the gems installed in your machine with their versions.For Ex:-

rack (1.0.0)
rails (2.3.4, 2.1.1)
rake (0.8.7)

是在不同项目上使用不同版本的Rails的最佳方法吗?

我的观点是,不,对不同的项目使用不同的Rails版本不是一个好习惯.但是有时您使用的是较早版本的旧项目,因此只能选择安装该Rails版本.但是,在创建新应用程序时,您应该使用最新的稳定Rai​​ls版本.

My point of view is that No it's not a good practise to use diiferent Rails version for the different projects. but sometime you used your old projects which is of an earlier version so you have no option but install that rails version. But while creating a new application you should used the latest stable rails version.

为便于记录,您可以通过在enviorment.rb中提及Rails版本来为不同的项目使用不同的Rails版本:-

Just for record you can used different Rails version for different projects by mentioning Rails version in enviorment.rb For Ex:-

RAILS_GEM_VERSION = '2.1.1' unless defined? RAILS_GEM_VERSION

这篇关于多个项目的多个Rails版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆