<%
  association_name = field.association[:name]
  child_key = field.association[:child_key].first
  collection = field.associated_collection.sort_by{|object| object.first}
  selected = field.value

  if selected.nil? && params["associations"]
    selected = params["associations"][child_key.to_param.pluralize].to_i
  end
%>
                  <label for="associations[<%= association_name%>]"><%= field.label %></label>
                  <%= select("associations", association_name, collection, {:id => association_name, :include_blank => true, :selected => selected}, :class => "#{field.has_errors? ? "errorField" : nil}") %>

<%
  association_name = field.association[:name]
  child_key = field.association[:child_key].first
  collection = field.associated_collection.sort_by{|object| object.first}
  selected = field.value

  if selected.nil? && params["associations"]
    selected = params["associations"][child_key.to_param.pluralize].to_i
  end
%>
              <div class="field <%= field.to_param %>">
                <label for="associations[<%= association_name%>]"><%= field.label %></label>
                <%= select("associations", association_name, collection, field.html_attributes) %>
                <% if field.has_errors? %>
                <span class="errorMessage"><%= "#{field.label } #{field.errors.first}" %></span>
                <% end %>
                <p class="help"><%= field.help %></p>
              </div>                  

Fix has one association to render like belongs to in form
Fix has one association to render like belongs to in form
