我正在通過Michael Hartl的Rails教程和第3.4節「生成StaticPages控制器」,我無法執行'rails generate controller StaticPages home help' 。當我鍵入命令,我收到以下消息看起來是一個軌道的幫助信息:Hartl Rails教程第3節'rails generate controller'
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile] # Don't create a Gemfile
-B, [--skip-bundle] # Don't run bundle install
-G, [--skip-git] # Skip .gitignore file
[--skip-keeps] # Skip source control .keep files
-O, [--skip-active-record] # Skip Active Record files
-S, [--skip-sprockets] # Skip Sprockets files
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
-j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
# Default: jquery
-J, [--skip-javascript] # Skip JavaScript files
[--dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge] # Setup the application with Gemfile pointing to Rails repository
-T, [--skip-test-unit] # Skip Test::Unit files
[--rc=RC] # Path to file containing extra configuration options for rails command
[--no-rc] # Skip loading of extra configuration options from .railsrc file
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend] # Run but do not make any changes
-q, [--quiet] # Suppress status output
-s, [--skip] # Skip files that already exist
Rails options:
-h, [--help] # Show this help message and quit
-v, [--version] # Show Rails version number and quit
Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.
Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.
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.
我也嘗試過「軌產生integration_test static_pages」只是爲了看看會發生什麼,以及它返回相同的消息。不知道這是否意味着什麼,但我想我會把它包括在這裏。
你創建的Rails應用程序? – alex
即使您的確是按照@alex的說法創建了應用程序,請檢查您是否確實在其中進行了「cd」操作(即檢查您是否在您的應用程序根目錄中)。 – zrl3dx
是的,我創建了rails應用程序,並正在從sample_app目錄進行工作。 – user3163541