找到你要的答案

Q:Develop with Rails 3 when Rails 4 is already installed

Q:当Rails 4已安装时,用Rails 3开发

I have to begin local development of this open-source project, but it uses Rails 3.2.21, and I already have Rails 4.x installed. How can I specify that I want to work with Rails 3 only when working on this app?

我要开始的地方这个开源项目的发展,但它使用Rails 3.2.21,我已经有X安装Rails 4。我怎样才能指定,我想与Rails 3只工作时,这个应用程序?

answer1: 回答1:

You should use a ruby version manager, something like rvm, rbenv or chruby, each doc will tell you what to do.

This way you could have different ruby versions installed, and with bundler you could use different rails versions according to the Gemfile.

Just add a .ruby-version file inside the project root, and the version manager should detect it.

你应该使用一个Ruby版本经理,像RVM,rbenv或上腔,每个医生都会告诉你怎么做。

这样你可以有不同版本的Ruby安装和打包机可以根据Gemfile使用不同的版本。

在项目根目录中添加一个Ruby版本文件,版本管理器应该检测它。

answer2: 回答2:

In your Gemfile specify the rails version you want that project to use:

# Gemfile

gem "rails", "~> 3.2.21"

在你指定你想要Gemfile项目使用的版本:

# Gemfile

gem "rails", "~> 3.2.21"
answer3: 回答3:

If you will change the rails version directly in Gemfile, it may raise issue for compatibility later:

Instead use RVM or other related version manager and after isntalling use below command: - rvm use 1.9.3 - bundle install - Then mention the version in Gem file

如果你将在Gemfile直接改变版本,它可以提高兼容性后问题:

Instead use RVM or other related version manager and after isntalling use below command: - rvm use 1.9.3 - bundle install - Then mention the version in Gem file

answer4: 回答4:

To use the specific rails version with your app you can do this:

rails _3.2.21_ myApp

If you don't already have rails 3.2.21 installed just run this:

gem install 'rails' -v '3.2.21'

要使用特定的Rails版本与您的应用程序,您可以做到这一点:

rails _3.2.21_ myApp

如果你不已经有轨3.2.21只运行此安装:

gem install 'rails' -v '3.2.21'
ruby-on-rails  ruby-on-rails-3