0

インストール後に最初のプログラムを作成しようとしましたが、次のようなエラーが発生しました。

Routing Error
No route matches [GET] "/firstapp"

config/routes.rbファイルを変更しようとしましたが、何も変わりませんでした。これは私のconfig/routes.rb

Firstapp::Application.routes.draw do
  resources :apptables

  # The priority is based upon order of creation:
  # first created -> highest priority.

  # continues with default `config/routes.rb` explanations...
end    

config/routes.rbを適切に実行するように構成するにはどうすればよいですか?

4

1 に答える 1

3

言うだけresources :apptables で、標準の 7 つのルートが設定されます

GET    /apptables
GET    /apptables/new
POST   /apptables
GET    /apptables/:id
GET    /apptables/:id/edit
PUT    /apptables/:id
DELETE /apptables/:id

そのリストには no がない/firstappため、ルートは機能しません。GET を機能させたい場合は、/firstappそのルートを手動で設定できます。

match '/firstapp' => 'firstapp#some_method', :via => :get

それは GET/firstappを にルーティングしFirstappController#some_methodます。

于 2011-09-23T07:20:11.397 に答える