resource routes without member id

rest, routes, ruby-on-rails

Solution

You forgot to add `s` in the end:

resources :categories

`resources` and `resource` are different things: resources and resource.

Problem

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?

Original source