# Multiple calls to map.resources not working

**URL:** <https://www.ruby-forum.com/t/multiple-calls-to-map-resources-not-working/142147>\
**Category:** Rails\
**Created:** [July 3, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/multiple-calls-to-map-resources-not-working/142147 "2008-07-03T21:24:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [July 3, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/multiple-calls-to-map-resources-not-working/142147/1 "2008-07-03T21:24:11Z")

</div>

I need to extend a RESTful controller (ads) with two aditional actions  
(search and coincidences), so I include the following code in my  
routes.rb file:

map.resources :ads, :collection =\> {:coincidences =\> :get}  
map.resources :ads, :collection =\> {:search =\> :get}

however, I can only get one of these sentences to work - the one that  
comes first. The second one seems to be ignored.

How can it be fixed?

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [July 3, 2008, 10:04pm UTC](https://www.ruby-forum.com/t/multiple-calls-to-map-resources-not-working/142147/2 "2008-07-03T22:04:02Z")

</div>

map.resources :ads, :collection =\> {:coincidences =\> :get, :search  
=\> :get}

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [July 3, 2008, 10:16pm UTC](https://www.ruby-forum.com/t/multiple-calls-to-map-resources-not-working/142147/3 "2008-07-03T22:16:58Z")

</div>

Thanks Wolas, worked like a charm. I knew it had to be something as  
easy as that, but couldn’t find any examples.  
Thanks again.

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [July 4, 2008, 3:40am UTC](https://www.ruby-forum.com/t/multiple-calls-to-map-resources-not-working/142147/4 "2008-07-04T03:40:48Z")

</div>

Abel:

I saw it and I had to comment… a search doesn’t really need its own  
additional action. Search just returns records (in your case, ads), but  
with  
a filter applied. Generally, if you’re doing RESTful design, Search  
forms  
just do GET to the Index action, and the controller checks parameters to  
determine how the results get populated.
