1

我正在尝试使用 ryan bates 的示例代码,该代码用于他在 Daemon 上的 railscast(第 129 集)。我安装了 rails 3,当我下载他的代码时,我无法运行服务器。为了尝试解决这个问题,我从标准 rails 3 应用程序中复制了我的 gemfile 和 gemfile.lock,并将其放入他的应用程序中,然后运行 ​​bundle install。尽管如此,我的 Rails 服务器还是没有响应。相反,我得到以下(见下文)。

我的猜测是我遇到了问题,因为 railscasts 使用 rails 2(我相信),而我使用的是 rails 3。有什么方法可以让我仍然使用他的程序吗?

谢谢。

用法:

rails new APP_PATH [options]

选项:

-r, [--ruby=PATH]           # Path to the Ruby binary of your choice
                              # Default: /home/kyala/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
-d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)enter code here
                              # Default: sqlite3
 -b, [--builder=BUILDER]     # Path to an application builder (can be a filesystem path or URL)
-m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
      [--dev]                 # Setup the application with Gemfile pointing to your Rails 
checkout
      [--edge]                # Setup the application with Gemfile pointing to Rails 
repository
[--skip-gemfile]        # Don't create a Gemfile
 -O, [--skip-active-record]  # Skip Active Record files
 -T, [--skip-test-unit]      # Skip Test::Unit files
 -J, [--skip-prototype]      # Skip Prototype files
 -G, [--skip-git]            # Skip Git ignores and keeps

Runtime options:
-f, [--force]    # Overwrite files that already exist
-p, [--pretend]  # Run but do not make any changes
 -q, [--quiet]    # Supress status output
 -s, [--skip]     # Skip files that already exist

Rails options:
 -v, [--version]  # Show Rails version number and quit
  -h, [--help]     # Show this help message and quit

描述:该rails new命令在您指定的路径创建一个具有默认目录结构和配置的新 Rails 应用程序。

例子:

rails new ~/Code/Ruby/weblog

这会在~/Code/Ruby/weblog.

请参阅新创建的应用程序中的 README 以开始操作。

4

2 回答 2

0

要在 rails 3 中运行服务器,您应该使用源文件夹中的以下命令:

rails server

但我认为安装 rails 2 和适当版本的 ruby​​ 比尝试解决从 rails 2 迁移到 rails 3 的问题更容易。要在不同的 ruby​​ 版本之间切换,您可以使用rvm

于 2012-01-20T13:58:12.703 回答
0

这不会以这种方式工作。rails 3.x 和 2.x 之间存在太多差异(rails 命令的不同行为、不同的配置、捆绑器等)。

我会创建一个新的 rails 项目,然后从截屏视频中复制 app 文件夹。

无论如何,这不是一个好主意,因为用于 rails 2.x 的 gem 与 rails 3.x 中的 gem 不同,因此您很可能会遇到这种方法的一些错误。

于 2012-01-20T15:21:46.507 回答