In your controller, you call
query, but query isn't defined anywhere. What you probably want is
params['query'].
So, in your controller, first do
Code:
@query = params['query']
before you do
Code:
@results = Product.search @query # Note the @query instead of query, because I assigned params['query'] to @query instead of to query
Then, in your view, you can use:
Code:
<td width="50" <%= text_field_tag 'query', @query %>
<td width="100"><%= submit_tag "Search" %>
Note, that you quoted @query in your view, which means that you get the literal value '@query' instead of the value of the @query instance variable. Also you didn't assign anything to the @query instance variable in your controller. (The instance variables in your controller are inherited by the views.)
Lastly, there don't seem to be many Rails coders on this forum (I've only just registered myself and I'm not a habitual reader), so next time asking your question on
the excellent "Ruby on Rails: Talk" Google group may give you an answer sooner.