Route in layout doesn't work with params

Say you have a search route that posts to the create resource in the
search controller called from the layout RHTML. All is fine until you go
to a route that takes an ID, say like items/2, and try to do a search
from there. So the items will change to search but the 2 will be with it
(search/2) and a routing error will occur:

Routing Error

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

So to be thorough, in my application.rhtml layout that is in place for
every controller, I have for_form :search, :url => search_url, and that
causes a routing issue from URLs that have a value being passed in.

Any help would be great!

NM, it works with a custom named route.

Guest wrote:

Say you have a search route that posts to the create resource in the
search controller called from the layout RHTML. All is fine until you go
to a route that takes an ID, say like items/2, and try to do a search
from there. So the items will change to search but the 2 will be with it
(search/2) and a routing error will occur:

Routing Error

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

So to be thorough, in my application.rhtml layout that is in place for
every controller, I have for_form :search, :url => search_url, and that
causes a routing issue from URLs that have a value being passed in.

Any help would be great!