How to set the selected option for a combo box?


#1
Kategorie <% @selected_category = Category.find(:first, :select => "name, id", :conditions => ["id = ?", params['category_id']]) %> <% @all_categories = Category.find(:all, :order => 'id').collect {|c| ([c.name, c.id])} %> <%= options_for_select(@all_categories, @selected_category.name) %>