安装 Rails 3 后如何使用 Rails 2.3 应用程序生成器? [英] How to use the Rails 2.3 app generator when I have Rails 3 installed?
问题描述
澄清:只有一个 rails
命令,它是从最新的 Rails gem 安装的,它是 Rails 3 ATM.但是,我需要创建一个 Rails 2.3 应用程序.
to clarify: there's only one rails
command, which gets installed from the latest Rails gem, which is Rails 3 ATM. However, I'm required to create a Rails 2.3 app.
运行 ruby/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/bin/rails
失败并出现 NoMethodError,我想是因为它也尝试使用 gems从 3.0.0 版本开始.
Running ruby /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/bin/rails
fails with a NoMethodError, I suppose because it also tries to use gems from the 3.0.0 release.
卸载 gem 会产生一些奇怪的结果:
Uninstalling the gem produces some strange results:
$ gem uninstall rails-3.0.0
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d rails-3.0.0`
$ gem list -d rails-3.0.0
*** LOCAL GEMS ***
(and no gems here)
我该怎么办?
推荐答案
最简单的方法是:
- 为项目创建目录
创建一个包含
- Create the directory for the project
Create a
Gemfile
there containing
gem "rails", "2.3.9"
gem "sqlite3-ruby", :require => "sqlite3"
运行捆绑安装
您甚至不需要 rvm 来执行此操作.
You don't even need rvm to do this.
这篇关于安装 Rails 3 后如何使用 Rails 2.3 应用程序生成器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!