Rails 服务器未启动 - 尝试使用 Rails 3 运行 Ryan Bates Railscasts 应用程序中的代码

发布于 2024-12-28 03:05:06 字数 2004 浏览 2 评论 0原文

我正在尝试使用 Ryan Bates 的示例代码,他将其用于 Daemon 上的 Railscast(第 129 集)。我安装了rails 3,当我下载他的代码时,我无法运行服务器。为了尝试解决这个问题,我从标准 Rails 3 应用程序复制了 gemfile 和 gemfile.lock,并将其放入他的应用程序中,然后运行捆绑安装。尽管如此,我的 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 中生成一个 Rails 安装框架。

请参阅新创建的应用程序中的自述文件以开始操作。

I am trying to work with ryan bates' sample code that he uses for his railscast on Daemon (episode 129). I have rails 3 installed, and when I downloaded his code, I cannot run the server. To try and fix this, I copied my gemfile and gemfile.lock from a standard rails 3 application, and put it into his application, then ran bundle install. Still, my rails server does not respond. Instead, I get the following (see below).

My guess is that I am having issues because railscasts uses rails 2 (I believe) whereas I am using rails 3. Is there any way that I can still use his program?

Thanks.

Usage:

rails new APP_PATH [options]

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

Description:
The rails new command creates a new Rails application with a default
directory structure and configuration at the path you specify.

Example:

rails new ~/Code/Ruby/weblog

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.

See the README in the newly created application to get going.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

2025-01-04 03:05:06

这是行不通的。 Rails 3.x 和 2.x 之间有太多差异(rails 命令的不同行为、不同的配置、捆绑器等)。

我将创建一个新的 Rails 项目,然后从截屏视频中复制应用程序文件夹。

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

this is not going to work this way. there are too many differences between rails 3.x and 2.x (different behavior of rails command, different config, bundler etc).

i would create a new rails project and just copy the app folder from the screencast.

anyways, this is not a good idea, as the gems that are used for rails 2.x are different from those in rails 3.x so you will most likely experience some errors with this approach.

潇烟暮雨 2025-01-04 03:05:06

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

rails server

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

To run server in rails 3 you should use following command from your source folder:

rails server

But I think it's easier to install rails 2 and appropriate version of ruby than trying to fight issues of migrating from rails 2 to rails 3. To switch between different ruby version you may use rvm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文