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 4258622
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:40:26+00:00 2026-05-21T05:40:26+00:00

When dealing with a collection resource, I like to use the plural for the

  • 0

When dealing with a collection resource, I like to use the plural for the index (ie. list) page (viewing many objects), and singular for the other pages (create/update/delete one object).

In order to do so, I seem to have to create my routes like so:

map.objects 'objects.:format', :controller => :object, :action => :index, :conditions => { :method => :get }
map.resources :object, :controller => :object, :except => :index

This creates routes like so:

     objects GET    /objects(.:format)          {:action=>"index", :controller=>"object"}
object_index POST   /object(.:format)           {:action=>"create", :controller=>"object"}
  new_object GET    /object/new(.:format)       {:action=>"new", :controller=>"object"}
 edit_object GET    /object/:id/edit(.:format)  {:action=>"edit", :controller=>"object"}
      object GET    /object/:id(.:format)       {:action=>"show", :controller=>"object"}
             PUT    /object/:id(.:format)       {:action=>"update", :controller=>"object"}
             DELETE /object/:id(.:format)       {:action=>"destroy", :controller=>"object"}

It works, but it seems like I’m using an extra line in my routes file (to explicitly specify the index route) when I shouldn’t have to. Is there a way to do what I want in one route? Or, alternately, is there a reason not to route this way?

  • 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-21T05:40:27+00:00Added an answer on May 21, 2026 at 5:40 am

    RESTful routing is designed in such a way that you’re scoping down what it is you want to do. Say you go to http://example.com/objects. Here, you’re telling the site you want a list objects.

    Now when you go to http://example.com/objects/2 you’re telling it you want to see the object with identifier of 2 in that list (or resource) of objects.

    Finally, when you go to http://example.com/objects/2/edit you’re saying you want to find the object again with identifier of 2 but this time you would like to edit it rather than view it.

    By going against the grain like you have suggested in routing helpers you will be causing a tremendous amount of unnecessary pain for yourself and for anybody else reading your code.

    However if you do choose to go this path (again, I advise against it) then yes, defining two routes is the only way.

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

Sidebar

Related Questions

Other questions dealing with use of match_parent pre 2.2 have answers stating one should
I am dealing with a collection of objects where the reasonable size of it
Imagine an object you are working with has a collection of other objects associated
When dealing with a collection of key/value pairs is there any difference between using
When dealing with a series of numbers, and wanting to use hash results for
I am dealing with very primitive HTML construction that goes like this: <a NAME=header1></a><b><font
I am dealing with a (PHP5) class that uses a MySQL resource ( public
Starting with a collection of strings like: (def str-coll [abcd efgh jklm]) The goal
I'm dealing with nHibernate performance problem during hydration of a collection. The nHibernate-generated query
When given an d you could be dealing with a fixed sequence like a

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.