Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:00:46+00:00 2026-05-29T10:00:46+00:00

What is the logical difference between resource and resources methods Here is some examples:

  • 0

What is the logical difference between resource and resources methods

Here is some examples:

resource :orders, :only => [:index, :create, :show]

> rake routes
 orders POST       /orders(.:format)            orders#create
        GET        /orders(.:format)            orders#show


resources :orders, :only => [:index, :create, :show]

> rake routes
 orders GET        /orders(.:format)            orders#index
        POST       /orders(.:format)            orders#create
  order GET        /orders/:id(.:format)        orders#show


resource :orders

> rake routes
     orders POST       /orders(.:format)            orders#create
 new_orders GET        /orders/new(.:format)        orders#new
edit_orders GET        /orders/edit(.:format)       orders#edit
            GET        /orders(.:format)            orders#show
            PUT        /orders(.:format)            orders#update
            DELETE     /orders(.:format)            orders#destroy


resources :orders

> rake routes
     orders GET        /orders(.:format)            orders#index
            POST       /orders(.:format)            orders#create
  new_order GET        /orders/new(.:format)        orders#new
 edit_order GET        /orders/:id/edit(.:format)   orders#edit
      order GET        /orders/:id(.:format)        orders#show
            PUT        /orders/:id(.:format)        orders#update
            DELETE     /orders/:id(.:format)        orders#destroy

It looks like method resource does not create route for index, and helpers in some cases are different (new_order and new_orders). Why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:00:47+00:00Added an answer on May 29, 2026 at 10:00 am

    Actually you are right, resource should not create an index action, unless you ask for the index action explicitly, this way:

    resource :orders, :only => [:index, :create, :show]
    

    Helpers should differ too, but not that much as in your example, because the convention is to use a singular form with the resource method, and the plural with the resources

    resources :orders
    => rake routes
    
         orders GET        /orders(.:format)            orders#index
                POST       /orders(.:format)            orders#create
      new_order GET        /orders/new(.:format)        orders#new
     edit_order GET        /orders/:id/edit(.:format)   orders#edit
          order GET        /orders/:id(.:format)        orders#show
                PUT        /orders/:id(.:format)        orders#update
                DELETE     /orders/:id(.:format)        orders#destroy
    
    resource :order
    => rake routes
          order POST       /order(.:format)            orders#create
      new_order GET        /order/new(.:format)        orders#new
     edit_order GET        /order/:id/edit(.:format)   orders#edit
                GET        /order/:id(.:format)        orders#show
                PUT        /order/:id(.:format)        orders#update
                DELETE     /order/:id(.:format)        orders#destroy
    

    And the logical difference is to declare you logically can’t have the plural for resource in your app, for example Admin or whatever

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Cocoa is full of singletons. Is there a logical/conventional difference between when the Cocoa
Is there any difference between logical SSE intrinsics for different types? For example if
Is there a logical difference between the following two blocks? And is there one
Possible Duplicate: What is the difference between logical and conditional AND, OR in C#?
I am not able to exactly difference between kernel logical address and virtual address.
what is the difference between logical right shift and arithmetic right shift?
Given a table of logical resource identifiers (one per row), what is the best
What's the difference between try { fooBar(); } finally { barFoo(); } and try
What is the difference by Keyboard focus and logical focus in WPF? and how
What is the difference between the two pieces of code below? This returns the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.