# No route found to match "/search" with {:method=\>:get}

**URL:** <https://www.ruby-forum.com/t/no-route-found-to-match-search-with-method-get/113313>\
**Category:** Rails\
**Created:** [August 29, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/no-route-found-to-match-search-with-method-get/113313 "2007-08-29T19:08:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bashar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b9bd4f/32.png) [@bashar](https://www.ruby-forum.com/u/bashar)\
**Post date:** [August 29, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/no-route-found-to-match-search-with-method-get/113313/1 "2007-08-29T19:08:22Z")

</div>

Hi,

I am a bit new to the whole RoR thing and have faced small problem,  
but was not able to fine related answer to my specific condition. I am  
writing an application called site which I want to be the default root  
application. I did the required configuration in routes.rb file.

Problem is, on the main page, I have a GET form that does not wrap  
object model, and has an id. I tried manual HTML and it didn’t work  
when I am visiting the site from [http://localhost:3000](http://localhost:3000) because the  
action ‘search’ will point to non-existing action on that level,  
yielding error:

no route found to match “/search” with {:method=\>:get}

if I go to [http://localhost:300/site/index](http://localhost:300/site/index) and do the search it works  
fine. I tried the form\_tag and it also didn’t help. Any idea how I can  
overcome this issue?

---

<div class="post-metadata">

**Author:** ![bashar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b9bd4f/32.png) [@bashar](https://www.ruby-forum.com/u/bashar)\
**Post date:** [September 2, 2007, 12:09pm UTC](https://www.ruby-forum.com/t/no-route-found-to-match-search-with-method-get/113313/2 "2007-09-02T12:09:45Z")

</div>

hm, if i am understand you need implement routes,

in config/routes.rb, something in middle do:  
map.search “/search”, :controller =\> “site”, :action =\> “index”

then /search path will be available, for anything.

also you will be able to make restful url, like:  
link\_to “Seach on site”, search\_url

---

<div class="post-metadata">

**Author:** ![bashar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b9bd4f/32.png) [@bashar](https://www.ruby-forum.com/u/bashar)\
**Post date:** [September 2, 2007, 12:56pm UTC](https://www.ruby-forum.com/t/no-route-found-to-match-search-with-method-get/113313/3 "2007-09-02T12:56:50Z")

</div>

Jamal: Thanks. Your solution worked.

Alexey: Your solution worked as well. Thanks.

I think I will go with the name mapping seems better on the long run.
