# Routes and collections

**URL:** <https://www.ruby-forum.com/t/routes-and-collections/125546>\
**Category:** Rails\
**Created:** [January 10, 2008, 2:12am UTC](https://www.ruby-forum.com/t/routes-and-collections/125546 "2008-01-10T02:12:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@dhf](https://www.ruby-forum.com/u/dhf)\
**Post date:** [January 10, 2008, 2:12am UTC](https://www.ruby-forum.com/t/routes-and-collections/125546/1 "2008-01-10T02:12:31Z")

</div>

I am working on a inventory system that allows duplicate PartNumbers.  
Different vendors can use the same part number. I know I can make them  
unique by using the vendor as part of teh number but that would  
require the end user to know that id also. Also I do not have much  
control over the DB it is pre-existing.

I had several choices as to URL I wanted to use but so far have  
settled on /search/:item\_number but would rather have  
had /:item\_number. When I specify the url as previously, is it  
actually /search/1234 or /search?item\_number=1234

I have set up a couple of routes to test these things. Will any of  
them work? Draw backs on each and what would the internal path name be  
for use in a form\_tag?

map.resources :items , :collection =\> {:lost =\> :get}  
map.find “/search/:item\_number”, :controller =\> “public”, :action  
=\> “search”, :method =\> ‘get’  
map.resources :public, :collection =\> {:search =\> :get} #on this one  
how do I specify that it requires a value

I know GETs are to either return a collection with out any parameters  
or return one resource. In this case I am returning a collection based  
upon a parameter.

Any ideas?

Don F.

---

<div class="post-metadata">

**Author:** ![dhf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@dhf](https://www.ruby-forum.com/u/dhf)\
**Post date:** [January 10, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/routes-and-collections/125546/2 "2008-01-10T18:18:04Z")

</div>

Any Ideas?
