1

私はライアン・ベイツが Daemon のレールキャスト (エピソード 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

これにより、スケルトン Rails インストールが に生成され~/Code/Ruby/weblogます。

新しく作成されたアプリケーションの README を参照して、作業を開始してください。

4

2 に答える 2

0

Rails 3でサーバーを実行するには、ソースフォルダーから次のコマンドを使用する必要があります。

rails server

しかし、レール2からレール3への移行の問題と戦うよりも、レール2と適切なバージョンのrubyをインストールする方が簡単だと思います。異なるルビーバージョンを切り替えるには、rvmを使用できます。

于 2012-01-20T13:58:12.703 に答える
0

これはこのようには機能しません。rails 3.x と 2.x には違いが多すぎます (rails コマンドの動作の違い、設定の違い、バンドラーの違いなど)。

新しい Rails プロジェクトを作成し、スクリーンキャストから app フォルダーをコピーするだけです。

とにかく、これは良い考えではありません。Rails 2.x で使用される gem は Rails 3.x のものとは異なるため、このアプローチではエラーが発生する可能性が高いからです。

于 2012-01-20T15:21:46.507 に答える