"selected" in form.select

I have a search form in my navbar where a user can select in which
area he wants to search. After clicking the submit-button the
results get rendered but the previous selected area is no longer
selected.

<%= form.select (:suchfeld,
[ [‘Beschreibungen’,‘description’],
[‘Headlines’,‘headline’]] )
%>

I was able to re-fill the search-field wich the previous content
doing the following:

<%= form.text_field
:suche,
:name => “suche”,
:size => 25,
:value => params[:suche].gsub(’ ‘,’’)
%>

But how can I automatically add “selected” to a select-field to
select the last selected item?

Thanx

The easiest way is to use the html attrs parameter, like this:
<%= form.select (:suchfeld,

[ [‘Beschreibungen’,‘description’],
[‘Headlines’,‘headline’]]
, :selected => @varname
)
%>

where “@varname” is the value that was selected before posting. That
var would be set in the controller, probably when you are grabbing the
post data.