Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resource routes without member id

I develop a Rails application and I added simple route:

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

The problem is that there is no member id in the generated URLs:

$ 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

I use Rails 3.2.3. I don't use ActiveRecord in the application (but I don't know if it is relevant). I have a model Category and CategoriesController.

What might be the problem?

like image 554
mrzasa Avatar asked Jun 12 '12 07:06

mrzasa


1 Answers

You forgot to add s in the end:

resources :categories

resources and resource are different things: resources and resource.

like image 174
Mik Avatar answered Oct 10 '22 23:10

Mik