How Do I Fix Collection_select ?

collection_select does display the correct defaults when editing a record. Double check your syntax, here is an example:

<%= form.collection_select :id, MyModel.find(:all), :id, :name %>

If the value of :id on the left matches one of :id options on the right that will be the default value.

For the cases where you need to include a :selected parameter one easy solution is to just use select instead of collection_select. It only adds a couple of extra parameters and :selected option will work as advertised. Another possibility would be to override the initialize method in your model class to set the default value. Then when a new object is passed into collection_select it will already have the default and you don't even need to use :selected.

Aaron

<% form_for :contact, @contact do |f| -%>   <%= f.collection_select :type_code, Lookup_contact_type.find(:all), :description, :description, {:include_blank => true} %> <% end -%>

So does the value of @contact.type_code for the record you are editing match a description from one of the entries in Lookup_contact_type.find(:all)? If so then that will be the default selection. If you are not sure what the values are try adding some debug calls to your view:

<%= debug @contact %> <%= debug Lookup_contact_type.find(:all) %>

Aaron