0

実行rake routesしたところ、routes.rb ファイルにない多くのルートが見つかりました。

          home_index GET    /home(.:format)                              home#index
                     POST   /home(.:format)                              home#create
            new_home GET    /home/new(.:format)                          home#new
           edit_home GET    /home/:id/edit(.:format)                     home#edit
                home GET    /home/:id(.:format)                          home#show
                     PUT    /home/:id(.:format)                          home#update
                     DELETE /home/:id(.:format)                          home#destroy

scaffold の生成時に作成されたファイルを手動で削除しましたが、そのテストの混乱を完全にクリーンアップする方法がわかりません。

私の routes.rb ファイルには、次のものがあります。

  # define the root
  root :to => "home#about"

  # define all the possible routes from the home controller
  resources :home do
    get "about"
    get "create_subscription"
  end
4

1 に答える 1

0

Rails は、'resources' で宣言されたものに対して、多くのデフォルト ルートを作成します。これは、routes ファイルで ':only =>' を使用することで回避できます。http://guides.rubyonrails.org/routing.html#resources-on-the-webのセクション 2.2 および 4.6 を参照してください。

于 2013-02-03T01:18:09.317 に答える