18

Rails アプリケーションを開発し、簡単なルートを追加しました。

Name::Application.routes.draw do
  resource :categories
end

問題は、生成された URL にメンバー ID がないことです。

$ rake routes
categories      POST   /categories(.:format)      categories#create
new_categories  GET    /categories/new(.:format)  categories#new
edit_categories GET    /categories/edit(.:format) categories#edit
                GET    /categories(.:format)      categories#show
                PUT    /categories(.:format)      categories#update
                DELETE /categories(.:format)      categories#destroy

Rails 3.2.3 を使用しています。アプリケーションで ActiveRecord を使用していません (ただし、関連性があるかどうかはわかりません)。私はモデルを持っていCategoryますCategoriesController

何が問題なのですか?

4

1 に答える 1

33

最後に追加するのを忘れましsた:

resources :categories

resourcesresourceは別のものです: resourcesresource

于 2012-06-12T07:34:14.033 に答える