The Difference Between resource and resources in Rails

Rails provides two closely related routing helpers — resource and resources — and although they look similar, they serve different purposes. Understanding the distinction between them is essential for designing clean, intention-revealing routes in a Rails application.

What Are resource and resources?

Both helpers are used in config/routes.rb to generate RESTful routes. The key difference lies in whether the resource is singular or plural, and that directly affects the URLs and controller actions Rails creates for you.

resources: Plural Resources

resources is the most commonly used helper. It represents a collection of objects, where each item has its own identifier (usually an id).

Example:

1
resources :articles

This generates the full set of RESTful routes:

HTTP Verb Path Controller#Action
GET /articles articles#index
GET /articles/new articles#new
POST /articles articles#create
GET /articles/:id articles#show
GET /articles/:id/edit articles#edit
PATCH /articles/:id articles#update
DELETE /articles/:id articles#destroy

You use resources when:

Typical examples include posts, comments, products, and users.

resource: Singular Resources

resource (singular) represents a single object that does not need an ID in the URL. Rails assumes there is only one instance of that resource per context (often per user).

Example:

1
resource :profile

This generates a smaller set of routes:

HTTP Verb Path Controller#Action
GET /profile/new profiles#new
POST /profile profiles#create
GET /profile profiles#show
GET /profile/edit profiles#edit
PATCH /profile profiles#update
DELETE /profile profiles#destroy

Notice what’s missing:

You use resource when:

Common examples include user profiles, dashboards, shopping carts, or account settings.

Controller Naming Still Uses Plural

Even when using resource, Rails still expects a plural controller name:

1
2
resource :profile
# maps to ProfilesController

This keeps controller naming consistent across the framework.

Choosing the Right One

A good rule of thumb:

For example:

Why This Matters

Choosing between resource and resources is more than syntax — it communicates intent. Singular routes make your URLs cleaner, your controllers simpler, and your application easier to reason about.