# Parameter being stripped form Search form with Restful Routes

**URL:** <https://www.ruby-forum.com/t/parameter-being-stripped-form-search-form-with-restful-routes/122825>\
**Category:** Rails\
**Created:** [December 12, 2007, 5:06pm UTC](https://www.ruby-forum.com/t/parameter-being-stripped-form-search-form-with-restful-routes/122825 "2007-12-12T17:06:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdevore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9adbd/32.png) [@gdevore](https://www.ruby-forum.com/u/gdevore)\
**Post date:** [December 12, 2007, 5:06pm UTC](https://www.ruby-forum.com/t/parameter-being-stripped-form-search-form-with-restful-routes/122825/1 "2007-12-12T17:06:09Z")

</div>

I am having trouble with a search form and restful routes.

In my app I have a Topic model and a Classroom model. Topics can  
exist in classrooms but don’t have to so for that reason I have not  
nested them.

I want to have a form that passes a topic\_id and the search  
parameter. So I have a form that looks like this:

\<% form\_tag ({:action =\> “show”, :topic\_id =\> @topic.id, :id =\>  
@classroom.id} , {:method =\> ‘get’}) do %\>

\<%= text\_field\_tag :search, params[:search] %\> \<%= submit\_tag "Search", :name =\> nil %\>

\<% end %\>

But when I submit the form the search param is posted but the topic\_id  
param is stripped. So when searching for ‘gen’ I get:

/classrooms/1?search=gen

instead of:

classrooms/1?search=gen&topic\_id=43

The strange thing is that if I embed this in a link\_to (setting the  
additional param :search to a fixed value) the topic\_id param doesn’t  
get stripped. It is only when it is submitted via the form that the  
topic\_id parameter is stripped.

Any ideas?

Thanks
