# Can't seem to map a route as GET for controller/search/term

**URL:** <https://www.ruby-forum.com/t/cant-seem-to-map-a-route-as-get-for-controller-search-term/154016>\
**Category:** Rails\
**Created:** [November 24, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/cant-seem-to-map-a-route-as-get-for-controller-search-term/154016 "2008-11-24T17:22:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robkuz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/34f0e0/32.png) [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Post date:** [November 24, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/cant-seem-to-map-a-route-as-get-for-controller-search-term/154016/1 "2008-11-24T17:22:55Z")

</div>

Hi all,

I’m making a search features for a record with a keywords field  
(keywords is a string right now), and my routing is having consistency  
troubles. What I desire is:

> localhost:3000/controller/search/:keyword

I would like this form to be obeyed for both form-submitted searches and  
the HTML links I generate. However, :method =\> :get is not being  
obeyed, and my helper method returns “search?keyword=foo+bar”.

My routing is RESTful, and I have added the search action to the  
map.resources call. If I call “controller/search/keyword” directly I  
get this error:

> undefined method `index\_url’ for #SermonsController:0x4a0e1c4

I find this curious. My routing is before the map.connect call for the  
standard format.

Here’s my map call:

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

If I map the following line, I get a 500 error.

> map.search\_sermons ‘sermons/search/:keyword’,  
> :controller =\> :sermons, :action =\> :search

As you can guess this is confusing me.

Have I done anything wrong? My links are forced into the  
“controller/search?keyword=foo+bar” format, and my forms remain POST  
methods no matter what I try to override them with. How should I go  
about routing this?

Thanks,  
Robert

P.S. I currently have the site working with what I have, but I’d really  
like to make it consistent with the rest of the site’s routing scheme.
